Installing Drupal on 4.0-Mona
|Installing Drupal on 4.0-Mona|
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
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 = email@example.com
Replace: SMTP = localhost with your ISP's SMTP server; for details check out this page PHP mail function
Replace: sendmail_from = firstname.lastname@example.org 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.
|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 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:
This file runs the actual cron script cron.php its sole purpose is to convert local paths to server relative paths.
<? $dummy = file("http://localhost/drupal/cron.php"); ?>
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. the loop repeats indefinitely.
:next udrive\home\admin\program\unidelay.exe 60 udrive\usr\local\php\php.exe -n udrive\www\drupal\run_cron.php goto :next exit
The above batch file if run directly would be visible hence this batch file uses uniserv.exe to run the above hidden.
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 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.)
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.
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.