Overview
SML currently runs Apache 1 and Apache 2 instances on the same physical Windows PC. The Apache 2 instance permits PHP scripts whereas the Apache 1 does not. It may be advantageous to merge these two servers into one and just use PHP security to deny execution of PHP scripts in normal user folders.
Apache2 and PHP
- Apache 2 was installed to Duncan’s PC (somdjppc.som.hw.ac.uk) under c:Apache2.
- PHP5 was also installed to C:Apache2php5.1.4
- MySQL 5 is already present, under C:MySQL
PHPMyAdmin
- PHPMyAdmin permits web-based administration of MySQL and was installed to folder C:Apache2htdocsphpMyAdmin-2.6.4-pl3.
- In order to work, the local MySQL database requires to have users and tables established by running the scripts within folder C:MySQLscriptsphpadmin.
- Once the above scripts have been run, one configures config.inc.php with the database hosts and credentials which the software is permitted to use.
HelpSpot
- The Helpspot helpdesk utility was copied from s:apache2htdocshelpspot_1.3.1 to c:apache2htdocsHelpspot_1.3.1.
- The Zend Optimiser (required to serve encrypted PHP files used by Helpspot) was run from N:admininstallPHPZend.
Helpspot has embedded database credentials in it’s config file, but the MySQL database to which it connects is configured to permit connections only from our official webserver (www.sml.hw.ac.uk). To permit connection from Duncan’s test machine the following code was executed on the SML Database PC (80.146):
GRANT ALL PRIVILEGES ON helpspot.*
TO ‘helpspot’@’somdjppc.som.hw.ac.uk’
IDENTIFIED BY ‘-removed-’
WITH GRANT OPTION;
This is a modified fragment of the Helpspot installation SQL code held under \somfs2users2:sqlserverBackupMySQL5Scriptshelpspot
- Helpspot is then configured by editing config.php
- Helpspot is accessed via: http://somdjppc.som.hw.ac.uk/helpspot_1.3.1/admin.php
Testing the above shows Helpspot runs perfectly on the Apache 2 test setup, and thus can be easily moved to another Apache server.
Serendipity 0.9.1
This tech-blog is downloadable from http://www.s9y.org/ which also has detailed installation instructions.
The files were copied from s:apache2serendipity to c:apache2serendipity. During the original installation, one follows and installation script which ensures everything is in the right place, so copying the entire folder might be expected to generate some problems.
The local config file serendipity_config_local.inc.php stores the MySQL database credentials, which do not require modification as again, they refer to the SML Database PC (80.148).
The Database PC instance of MySQL requires configuration so that the Serendipity credenentials are accepted from the new Apache 2 instance under test here, and so the following code was executed using PHPMyAdmin:
GRANT ALL PRIVILEGES ON serendipity.*
TO ‘-removed-’@’somdjppc.som.hw.ac.uk’
IDENTIFIED BY ‘-removed-’
WITH GRANT OPTION;
This is a modified fragment of the Serendipity installation SQL code
held under \somfs2users2:sqlserverBackupMySQL5Scriptsserendipity
Serendipity should now be ready for testing. Opening the local Apache 2 Serendipity web page http://127.0.0.1/serendipity/ generates error:
"Warning: Smarty error: unable to read resource: "" in C:Apache2htdocsserendipitybundled-libsSmartylibsSmarty.class.php on line 1088"
A problem anticipated by moving the folder rather than re-installing it. See Serendipity forum on this exact error which suggests damaged files. This could have occured during a global search and replace that recently took place on these files. Re-installing afresh should resolve this.
Using VMware
With the success of the above trials, a VM was created using Apache 2.2 and based on a Windows XP pro SP2, with 6Gb HDD. The VM was created on Duncan’s Buffalo USb drive in folder XPSP2_6Gb_Apache2.
The IP number assigned was 137.195.80.145
Apache was installed to C:Apache2.2 and the httpd.conf modified to support virtual hosts. Of immediate interest is the support of the PHP script which would be placed within folder M:AV_Media (where M: maps to \SOMFS1, our Novell 6.0 server). This script is described elsewhere but is basically a modified PHP-based file browser, modified (by Duncan) to permit preview of audio/video files found in folders.
Network-drive Documentroot Problem
The c:winntsystem32driversetchosts file was modifed to test virtual hosting.
A line mapping media.sml.hw.ac.uk to the IP number of the Apache server was made (to save making an actual DNS change at this time).
When this URL is mapped - in httpd.conf - to a documentroot on the C: drive, all works well. However, when it is mapped to the actual Novell drive, M:AV_Media, Apache throws an error when starting. This has also been reported here - see also another article Running Apache with DocumentRoot on a Mapped Drive.
For Linux there is a workaround described here - might be of interest one day.
However, the current SML webservers used, until recently, to service documentroot from the S: drive of our Novell server, so Apache can service network-based documentroot. Why does it crash here then?
Network Documentroot Crashing - Solved: Dec 18th 2007
Apache 2.2.6 under Win32 can service a documentroot on a network drive. If one starts Apache as a service, it fails, even if one configures the service to run as the Windows login used by the web server. However, just double-clicking the c:apache2.2binhttpd.exe file and opening Apache in a console permits all virtual hosts specified (see below) to be viewed, even those with documentroot on a network drive.
The relevant sections of c:apache2.2confhttpd.conf are:
-to be inserted -
The contents of c:apache2.2confextra–insert- is:
-to be inserted -
Documentroot Size Considerations
Resiliance is provided by having the Apache webserver serve a copy of s:apachehtdocs from it’s local c: drive, so that a web prescence is maintained in the event of problems connecting to drive s:.
The current size (Jan 2008) of S:apachehtdocs is 2.5Gb.
In a VMware environment, the ideal scenario is
- a small VM having only the OS and Apache server configured
- a separate (possibly) virtual disk holding the documentroot
Ok, in a proper VMware environment one would use a SAN or some other external storage but this isn’t yet available in SML. To keep things easy, one should still create a small VM and host the documentroot on a separate virtual disk - named, say, drive D:
However - for the time being, since a proper VMware (VI3) solution will doubtless be implemented in 2008, it may be sufficient to host the Apache server and documentroot in a single VM.