Installing Drupal on 4.0-Mona: Difference between revisions
Line 187: | Line 187: | ||
(set /p dummy=run) >temp.txt <nul | (set /p dummy=run) >temp.txt <nul | ||
rem ##cron loop | rem ##cron loop | ||
:next | :next | ||
udrive\home\admin\program\unidelay.exe 60 | udrive\home\admin\program\unidelay.exe 60 |
Revision as of 08:40, 9 July 2009
Installing Drupal on 4.0-Mona |
Introduction
This step-by-step guide shows how to install Drupal on Uniform Server 4.0-Mona and how to resolve common issues such as PHP mail and cron.
Preparation - 1
Install Uniform server
Download Drupal
Copy files to Uniform Server
|
Enable Mod Rewrite
Drupal can use clean URLs this requires mod-rewrite to be enabled in Apache's configuration file.
Edit file: UniServer\udrive\usr\local\apache2\conf\httpd.conf
Locate this line (194):
#LoadModule rewrite_module modules/mod_rewrite.so
Remove the hash "#" as shown.
LoadModule rewrite_module modules/mod_rewrite.so
Preparation - 2
Create Drupal database
|
Optionally configure PHP email
After you complete the final step in Install and set-up Drupal see below you will receive the following warning message:
warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in Z:\www\drupal\includes\mail.inc on line 193. Unable to send e-mail. Please contact the site admin, if the problem persists.
If you are only exploring and testing Drupal's functionality you can safely ignore this (Its only a warning and not an error). However if you would like to send emails via your ISP you have three options.
A) Edit php.ini
Open php.ini located in folder UniServer\udrive\usr\local\php
Locate this section:
[mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. sendmail_from = me@localhost.com
Replace: SMTP = localhost with your ISP's SMTP server; for details check out this page PHP mail function
Replace: sendmail_from = me@localhost.com with your real email address issued to you by your ISP.
B) Install Fake Sendmail for Windows
If your ISP requires authentication install Fake Sendmail for Windows
C) Install a mailserver
One final option if you want to run your own mail server and your ISP does not block the mail ports check out this page Installing hMailServer
Install and set-up Drupal
The Drupal set-up is straight forward I have shown what needs to be entered in the action column.
For a test server enter whats highlighted in bold, alternatively enter your own specific data.
Drupal Step | Action |
---|---|
Start servers double click Server Start.bat | |
Type the following into browser address bar http://localhost/drupal/
This opens Drupal's installation page (http://localhost/drupal/install.php?profile=default) | |
1. Choose language | Click Install Drupal in English |
2. Verify requirements | Automatically Confirmed OK |
3. Set up database |
|
4. Install site | Automatically Confirmed |
5. Configure site |
|
I mentioned in Preparation-2 you will receive a mail warning this can safely be ignored. If you implemented either of the above solutions a warning will not be issued.
To view your new site click "your newsite" link (or type http://localhost/drupal/).
When you log into admin (click administer link) at the top of the admin page you will see
"Cron has not run. Please visit the status report for more information."
- Click the status report link:
- Navigate to "Cron maintenance tasks" to the right click "run cron manually"
- After a short time you will receive a message "Cron ran successfully."
Cron
Cron is unavailable on Windows it is a Unix process that periodically runs certain scripts. Although Drupal allows you to manually run cron.php this can can be inconvenient. The following section shows how to simulate cron on 4.0_Mona.
The solution is a portable-cron using 4.0_Mona components, three new files are required as follows:
run_cron.php
This file runs the actual cron script cron.php its sole purpose is to convert local paths to server relative paths.
UniServer\udrive\www\drupal\run_cron.php
<? $dummy = file("http://localhost/drupal/cron.php"); ?>
run_cron.bat
This batch file uses unidelay.exe to provide a periodic tick. At the end of each delay PHP is run in CLI mode and runs script run_cron.php.
UniServer\run_cron.bat
@echo off rem ################################################### rem # Created By: MPG (ric) rem ################################################### rem ## create a temp file with value run (set /p dummy=run) >temp.txt <nul rem ##cron loop :next udrive\home\admin\program\unidelay.exe 60 udrive\usr\local\php\php.exe -n udrive\www\drupal\run_cron.php rem ## read file value SET /P stop=<temp.txt rem ## repeat cron loop if set to run if %stop%==run goto :next rem ## not set to “run” clean-up and exit del temp.txt exit
The above batch file if run directly would be visible hence this batch file uses uniserv.exe to run the above hidden.
UniServer\run_cron_hidden.bat
start udrive\home\admin\program\uniserv.exe run_cron.bat
With the files in place start the servers and run run_cron_hidden.bat login to Drupal and check out the status report. Manually refresh this page say every 60 seconds to confirm Cron has been run.
Note 1: unidelay.exe 60 runs the cron-job every 60 seconds increase this as required.
Note 2: You can run Cron from Server_Start.bat add the following line just below line :END (forth line from bottom of file):
start %programit%uniserv.exe run_cron.bat
Hence every time you start the servers using Server_Start.bat or disk_start.vbs Cron will run.
You should also use a command-line utility such as PrcView[1] to kill the unidelay.exe process when you stop the servers by adding this line just below line :END in Stop.bat:
C:\utils\pv.exe -k -f unidelay.exe
(This assumes you placed pv.exe in C:\utils.)
Related links:
Portability
If you want a portable version of Drupal copy the folder UniServer and all its content to your USB memory stick that’s it. Don’t expect fantastic speeds however it is usable.
Summary
I have shown how easy it is to install Drupal on Uniform Server 4.0-Mona.
Cron a Unix process is required to periodically update Drupal's status, this is easily simulated as explained above.