My Opera is closing 3rd of March

Eko and Friends

Creating Drupal Development Environment

The development environment for Drupal is installed on Windows XP. Requirements:
  • 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
VertrigoServ Installation
  • 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.
VertrigoServ Tools: figure 1 PHP Memory Limit: figure 2 Wget Installation
  • Run the installer.
  • Add Wget path to path variable in windows environment variable settings.
Drupal Installation This is multi site configuration for Drupal. Multi site is designed as a way to share the same code base for multiple different Drupal based sites. These sites are separate and do not share content or administration. Multi-site just helps with managing the code base, shared themes and modules. Creating databases I created two database: sandbox and playground for www.sandbox.local and www.playground.local sites respectively. Drupal 6.8 supports MySQL and PostgreSQL. Adding hosts to Windows host file. I added two hosts: www.sandbox.local and www.playground.local to Windows host file in C:\WINDOWS\System32\Drivers\etc\
## Hosts
#
127.0.0.1    localhost
127.0.0.1    www.sandbox.local
127.0.0.1    www.playground.local
Apache 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';
Run the Drupal installation script http://www.sandbox.local/install.php http://www.playground.local/install.php when it's done. Drupal will display Installation Complete page. Drupal Installation Complete: figure 5, click to enlarge 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: Extract the smtp module to C:\Program Files\VertrigoServ\www\drupal\sites\all\modules\ folder. This module is shared because I put it to all\modules\ folder. Create phpmailer folder within smtp module folder and extract the PHPMailer to it. Enable the module by go to Navigation Menu, Administer > Site Building > Modules and select check box for the SMTP Authentication Support module. Go to Navigation Menu, Administer > Site Configuration > SMTP Authentication Support to configure it. Turn on the module. In the SMTP Server section, use smtp.gmail.com as an SMTP erver, SMTP ort 465, Use encrypted protocol SSL. In SMTP Authentication section, I use my Gmail user name and password. Do the same with www.playground.local site. SMTP Authentication Support: figure 6, click to enlarge 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

New to Hyperic HQ: Part 4 (end)

Comments

Fahmi Iqbalfahmiiqbal Monday, January 12, 2009 9:06:42 AM

eko, tadi gw k kosan lw. Mo install drupal, sekarng gw d kampus.

shane watsonshanewatson2012 Tuesday, January 11, 2011 6:31:12 AM

I am looking for such type of informative news and i get through this blog so i am very much thankful to you for sharing such a great information.
- drupal development

Write a comment

New comments have been disabled for this post.