Installing Drupal on 4.0-Mona

From The Uniform Server Wiki
Jump to: navigation, search

Contents

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

  1. A) Create a new folder named drupal_b (Can be any name)
  2. Extract a new copy of Uniform Server V4.0-Mona to this folder
     --- Database user name root - No need to change this
     --- Database password root - Before installing Drupal I recommend changing this using apanel
  3. Start Uniform Server.

Download Drupal

  1. B) Create a new folder drupal_a (Can be any name its only a temporary folder)
  2. Download Drupal 6.9 (or newer version) from here save to a convenient folder for example drupal_a
  3. Unzip the downloaded file (drupal-6.9.tar.gz) Windows cannot do this use something like 7-Zip Portable
     --- Download site: PortableApps.com
     --- File name: 7-Zip Portable - Multilingual file archiver and compressor
  4. B) Extract drupal-6.9.tar.gz to current path, creates a new folder drupal-6.9.tar open this folder C)
  5. C) Extract drupal-6.9.tar to current path, creates a new folder drupal-6.9 (D)
    inside this is a second folder drupal-6.9 containing all the drupal files E).

Copy files to Uniform Server

  1. F) Copy folder drupal-6.9 (E) to server root folder www (G)
  2. H) Rename folder drupal-6.9 to drupal
  3. I) Navigate to folder UniServer\udrive\www\drupal\sites\default
     --- Make a copy of file: default.settings.php
     --- Rename this copy to: settings.php

Drupal 1.gif

Top

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

Top

Preparation - 2

Create Drupal database

  1. Run Uniform server double click server_start.bat (\drupal_b\UniServer)
  2. With apanel displayed, under Tools click on phpMyAdmin
  3. Enter drupal in the "Create new database" (A)
  4. Select utf8_unicode_ci (B)
  5. Click Create (C)
  6. Stop server Stop.bat

Drupal 2.gif

Top

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


Top

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
  • Database name: drupal
  • Database user name: root
  • Database password: root
  • Click Save and continue
4. Install site Automatically Confirmed
5. Configure site
  • Site name: localhost
  • Site e-mail address: me@localhost


  • Username (admin): admin Use your own admin name
  • E-mail address: Use your own email address
  • Password (admin): root66 Use your own password
  • Confirm password: root66 Use your own password


  • Clean URL's radio button is Enabled no need to change
  • Update notification leave checked.
  • Click Save and continue

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."
  1. Click the status report link:
  2. Navigate to "Cron maintenance tasks" to the right click "run cron manually"
  3. After a short time you will receive a message "Cron ran successfully."

Top

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:

Top

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"); ?>

Top

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

Top

run_cron_hidden.bat

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 :NOTFOUND:

echo.
echo  Starting Drupal cron ...............
echo.
start udrive\home\admin\program\uniserv.exe run_cron.bat

Hence every time you start the servers using Server_Start.bat or disk_start.vbs Cron will run.

Top

stop_cron.bat

When you stop the servers, you'd also want to stop the unidelay process. The file temp.txt is used to break the loop. After killing unidelay.exe the file content is checked; if a value other than "run" is found it breaks the loop in run_cron.bat.

UniServer\stop_cron.bat

rem ## update temp file to stop
(set /p dummy=stop) >temp.txt <nul

rem ## kill off cron
udrive\home\admin\program\pskill.exe unidelay.exe c

exit

Alternatively, the two lines in stop_cron.bat can be placed in Stop.bat; add them just below line :END.

Related links:

Portable Cron

LCC portable cron program

Top

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.

Top

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.

Top


Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox
Uniform Server