Creating Drupal Development Environment
Monday, December 29, 2008 12:45:41 AM
The development environment for Drupal is installed on Windows XP.
Requirements:
PHP Memory Limit: figure 2
Wget Installation
Add code below in Section 3: Virtual Host in the httpd.conf.
Drupal Setting File
Configuring Automated Mail
Drupal uses site mail address as an automated-mail sent during user registration and notifications. In the figure 5, There is a warning that Drupal is unable to send mail. To enable automated-mail, SMTP mail server has to exist. But for this development environment, I use free Gmail SMTP server as an automated-mail.
Use Gmail For Automated Mail
requirements:
Maintaining Multisite Cron Task
Create cronall.php (or any name) file in C:\Program Files\VertrigoServ\www\drupal\ folder. Add code below to the file.
- VertrigoServ 2.21 - Software stack, include: Apache, MySQL, PhpMyAdmin, SQLite, SQLiteManager, and Zend Optimizer.
- Wget 1.11.4 - Used for maintaining Drupal cron task.
- Drupal 6.8
- Run the installer and follow the intruction.
- Run the VertrigoServ.
- Change the default password for MySQL and SQLiteManager for security purpose. Click VertrigoServ tray icon, Tools > PhpMyAdmin and Tools > SQLiteManager. Change the configuration.
- Change PHP memory limit VertrigoServ sets PHP memory limit to 8M. To help prevent errors in the installation process of Drupal, change it to 16M or larger. Click VertrigoServ tray icon, Settings > Component Settings. Change the PHP memory_limit value to 16M.
PHP Memory Limit: figure 2
Wget Installation
- Run the installer.
- Add Wget path to path variable in windows environment variable settings.
## Hosts # 127.0.0.1 localhost 127.0.0.1 www.sandbox.local 127.0.0.1 www.playground.localApache Virtual Hosts To enable multi site for Drupal we need to edit Apache configuration file. Click VertrigoServ tray icon, Config Files > httpd.conf. VertrigoServ Config Files: figure 3
Add code below in Section 3: Virtual Host in the httpd.conf.
NameVirtualHost *:80 #uncomment this line <VirtualHost *:80> DocumentRoot "c:/program files/vertrigoserv/www/drupal" ServerName www.sandbox.local </VirtualHost> <VirtualHost *:80> DocumentRoot "c:/program files/vertrigoserv/www/drupal" ServerName www.playground.local </VirtualHost> <VirtualHost *:80> DocumentRoot "c:/program files/vertrigoserv/www/" ServerName localhost </VirtualHost>Remember to restart the server. Click VertrigoServ tray icon, Server > Restart. VertrigoServ Restart: figure 4
Drupal Setting File
- Extract Drupal to C:\Program Files\VertrigoServ\www\drupal.
- Copy the default site folder in C:\Program Files\VertrigoServ\www\drupal\sites and rename it to www.sandbox.local and www.playground.local.
- Copy default.settings.php and rename it to settings.php in both www.sandbox.local and www.playground.local folder.
- Find $db_url and $base_url in both settings.php and change the value.
## www.sandbox.local settings.php file ## change only variables below and leave the rest # $db_url = 'mysqli:db_username:db_password@localhost/sandbox'; $base_url = 'http://www.sandbox.local';
## www.playground.local settings.php file ## change only variables below and leave the rest # $db_url = 'mysqli:db_username:db_password@localhost/playground'; $base_url = 'http://www.playground.local';
Configuring Automated Mail
Drupal uses site mail address as an automated-mail sent during user registration and notifications. In the figure 5, There is a warning that Drupal is unable to send mail. To enable automated-mail, SMTP mail server has to exist. But for this development environment, I use free Gmail SMTP server as an automated-mail.
Use Gmail For Automated Mail
requirements:
- smtp module
- PHPMailer - required by smtp module.
- Gmail account
Maintaining Multisite Cron Task
Create cronall.php (or any name) file in C:\Program Files\VertrigoServ\www\drupal\ folder. Add code below to the file.
<?php
/**
* This script scans the sites directory, and uses a regular expression to extract the sitenames.
* It then uses this sitename to execute the cronjob for these sites.
* You then only have to create a cronjob for this script.
* In this way, you can create and delete sites on the fly, but all their cronjobs will be executed.
*/
/***********
* SETTINGS
**********/
//the location of the 'sites' directory relative to this script.
$sitesDir = '..\drupal\sites';
/**
* A regular expression that matches the name of the directories in
* the 'sites' dir that you want to execute cronjobs for, with a
* backreference around the actual site name. (so we can exclude the
* domain part)
*
* If you don't know regular expressions you might want to brush up
* on them: [html:a href="http://www.regular-expressions.info/tutorial.html
" title="http://www.regular-expressions.info/tutorial.html
" rel="nofollow"]http://www.regular-expressions.info/tutorial.html
</a> *
* Alternatively, you can just copy the name of one of the directories
* in the site dir, put a backslash \ in front of all dots . and replace
* the actual name of the site with ([a-zA-Z0-9_-])
*/
$siteNameRegExp = 'www\.sandbox\.local\.([a-zA-Z0-9_-])';
//the url of the cron script, you should insert %s where the sitename should be inserted later.
$cronUrl = 'http://%s/cron.php';
//any other sites that you want to execute cronjobs for. Just comment this if you haven't got any.
$addedSites = array();
$addedSites[] = 'www.sandbox.local';
$addedSites[] = 'www.playground.local';
/***********
* END SETTINGS
**********/
error_reporting(E_ALL);
$sites = array();
$handle = opendir($sitesDir);
while ($file = readdir($handle)) {
if(ereg($siteNameRegExp, $file)){
$sites[] = ereg_replace($siteNameRegExp, '\\1', $file);
}
}
//default site
if(isset($addedSites) && is_array($addedSites)){
$sites = array_merge($sites, $addedSites);
}
foreach($sites as $site){
$cmd = 'wget --spider '.sprintf($cronUrl, $site);
echo 'Executing command: '.$cmd.'<br>';
exec($cmd);
}
?>
Create a new scheduled task in windows to run Opera (or any browser) with address either www.sandbox.local/cronall.php or www.playground.local/cronall.php. Verify the cron task in Navigation Menu, Administer > Reports > Status Reports.
Status Reports: figure 7












Fahmi Iqbalfahmiiqbal # Monday, January 12, 2009 9:06:42 AM
shane watsonshanewatson2012 # Tuesday, January 11, 2011 6:31:12 AM
- drupal development