eCSAMP-Setup
Introduction
This chapter describes the configuration of Apache2, PHP5 and MySQL 5.0.x on eComStation (OS/2) in detail. Information how to secure Apache2 and the other components is not part of this description.
Because I don't have to much time at the moment some parts are not fully translated. I hope to finish that later.
To foreclose: This setup works for me.
I've made some more changes to httpd.conf (virtual hosts,
modproxy usage), the additional config files and to PHP.INI.
Those are required for my purposes and not for the use case presented here!
Used software packages
- eCS 1.1 SMP (Dual Celeron 400 MHz, 768MB RAM)
- Apache v2.2.3b3 + Fixes
- PHP v5.1.5b1 + Fixes
- MySQL v5.0.24b2 (took most of the time, as I updated my own REXX script for the basic configuration)
- phpMyAdmin v2.8.2.4
- used GCC Libs (libc*.dll, gcc*.dll)
Installation packages
First we begin with the packages. I've installed the following *.ZIP packages.
Apache 2.2.3b3:
http://download.smedley.info/httpd-2.2.3-os2-b3.zip
http://smedley.info/httpd-2.2.3-os2-b3fix1.zip
PHP 5.1.5b1:
http://download.smedley.info/php-5.1.5-os2-b1.zip
http://download.smedley.info/php-5.1.5-os2-b1fix1.zip
http://download.smedley.info/modphp5fix.zip (Paul hat diese Paket auf der Website unter Apache abgelegt, aber es gehört zu PHP)
phpMyAdmin 2.8.2.4:
http://switch.dl.sourceforge.net/sourceforge/phpmyadmin/phpMyAdmin-2.8.2.4.zip
MySQL 5.0.24b2:
http://download.smedley.info/mysql-5.0.24-os2-b2.zip
Weitere Anforderungen (hoffe nichts vergessen zu haben):
ftp://ftp.netlabs.org/pub/gcc/libc-0.6.1-csd1.zip
Extraction of the archives
I'll explain the configuration in the next step. First I only describe where to put the files (especially the fixes).
General Information:
PHP5 and Apache2 are stored in "D:\OS2TOOLS\INET\WEBSERVER\APACHE_SERVER".
Therewith everything from Apache2 is stored in "D:\OS2TOOLS\INET\WEBSERVER\APACHE_SERVER\Apache2"
and everything from php is stored in "D:\OS2TOOLS\INET\WEBSERVER\APACHE_SERVER\php5".
Apache 2.2.3b2:
First extract the Apache2 base package (in this example: httpd-2.2.3-os2-b3.zip).
The archive automatically creates the directory "Apache2".
Then we have to extract the corrections (httpd-2.2.3-os2-b3fix1.zip) into the directory ".\Apache2\bin" entpacken or you extract the package elsewhere and move the extracted content (in this case it's only the "httpd.dll") manually to ".\Apache2\bin".
PHP 5.1.5b1:
Zunächst das Basispaket von PHP5 (hier: php-5.1.5-os2-b1.zip) entpacken, wobei automatisch das Unterverzeichnis "php5" erstellt wird.
Dann die Korrektur (php-5.1.5-os2-b1fix1.zip) in das soeben erstellte Verzeichnis ".\php5" entpacken oder die Datei wie zuvor so entpacken und den Inhalt (hier ist es nur die "php5.dll") manuell nach ".\php5" verschieben.
Als letztes noch das Archiv mit dem korrigierten Apache2 Modul für PHP5 ("modphp5fix.zip") in das Verzeichnis ".\php5\Apache2" entpacken oder den Inhalt nach dem entpacken dorthin verschieben.
Die ebenfalls in diesem Archiv enthaltene "libc062x.dll" muss in einem Pfad abgelegt sein das durch "LIBPATH=.." (CONFIG.SYS) oder "SET BEGINLIBPATH=..." erreichbar ist.
Da in Zukunft sicher auch noch andere Programme diese DLL benötigen werden, macht es vielleich Sinn sie gleich nach ".\OS2\DLL" zu verschieben.
Den Inhalt des Verzeichnisses ".\php5\Apache2" (auf jeden Fall die "modphp5.dll"; wenn man die "libc062x.dll" z.B. schon nach ".\OS2\DLL" kopiert hat braucht man sie nicht zu kopieren) kopieren wir auf jeden Fall nach ".\Apache2\modules".
phpMyAdmin 2.8.2.4:
Die Daten des Webservers liegen bei mir unter "d:\httppath" (wieder wegen dem einfachen Backup).
Generell ist phpMyAdmin also in einem Verzeichnis unterhalb des DocumentRoot Ordners zu entpacken.
MySQL 5.0.24b2:
Extract MySQL to a directory of your choice.
Configuration
Now the interesting part starts. The path information provided here relates to my personal configuration preferences and is therefore only an example how you can do it.
Apache 2.2.3b3:
First we modify the "startup.cmd" in ".\Apache2".
As example I added my own file. Normally you only need to
update the "SET BEGINLIBPATH=..." setting with the correct path
information.
rem adjust as necessary
SET LIBPATHSTRICT=T
SET BEGINLIBPATH=d:\os2tools\inet\webserver\Apache_Server\Apache22\bin;d:\os2tools\inet\webserver\Apache_Server\Apache22\modules;d:\os2tools\inet\webserver\Apache_Server\PHP5;
bin\httpd -d . 2>&1
Then the changes needed in the Apache2 configuration follow. At first we have to copy (rename) the supplied httpd.conf.sample file in directory ".\Apache2\conf" (xcopy httpd.conf.sample httpd.conf). Then we have to edit the httpd.conf file.
NOTICE:
In the following steps I'll only add or comment some lines (Comment character is
the hash/pound key ("#")) aufführen.
Because it makes sense to add the new lines where it makes sense (nice sentence),
you can search for the first word of the line (e.g. at the "AddType"
line to activate the recognition of PHP code in *.html and/or *.php files).
If there is in the following one line with a blank line between the next entry,
it's also in the http.conf not directly one below the other.
If it's a block that had to be changed, then there is no blank line between
the next entry!
The complete path "d:/..." have to be changed to match your
own structure!
LoadModule php5_module modules/modphp5.dll
ServerName my.server.com:80
DocumentRoot "d:/httppath"
#
# This should be changed to whatever you set DocumentRoot to.
#
#<Directory "/apache2/htdocs">
<Directory "d:/httppath">
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
# DirectoryIndex index.html
DirectoryIndex index.html index.php
</IfModule>
# PHP
AddType application/x-httpd-php .htm .html .php
AddType application/x-httpd-phps .phps
PHP 5.1.5b1:
To use PHP5 you have to start with one of the included example configurations
("php.ini-dist" or "php.ini-recommended").
Copy one of them to "php.ini", modify it and finally copy/move
it into the directory "\MPTN\ETC" of the boot partition.
In the PHP.INI the comment character is ";" used.
If a line starts with this character the following text will be ignored.
Some parameters have to be enabled by removing the ";" character!
You have to change the following things:
-
If you want you can hide that you are using PHP...
expose_php = Off -
The path to the directory with the PHP modules that include the
DLLs for the MySQL access (mysql.dll,...)
extension_dir = "d:\os2tools\inet\webserver\apache_server\php5\modules" -
Needed extensions have to be activated by removing the ";"
character at the beginning of the line. In my case I need to activate
MySQL and also PostgreSQL support. I you don't need PostgreSQL
you can leave it as it was.
extension=mysql.dll
extension=pgsql.dll -
Temorary upload directory
upload_tmp_dir = "d:\tmp" -
The timezone which should be set according to Paul Smedley
(see readme.os2 and http://us2.php.net/manual/en/timezones.php).
For Germany the following setting should work (don't forget to remove the comment character).
date.timezone = Europe/Berlin
phpMyAdmin 2.8.2.4:
You can follow the installation description in the documentation of phpMyAdmin
(Documentation.html).
To shorten things a little bit I've added a complete configuration file
(config.inc.php) without special security settings (see "auth_type")
for the access to phpMyAdmin.
The configuration file will be stored in the phpMyAdmin directory
(phpmyadmin-2.8.2.4) abgelegt. In my case this is
"d:\httppatch\phpmyadmin-2.8.2.4".
/*
* Generated configuration file
* Generated by: phpMyAdmin 2.8.2.4 setup script by Michal äihař <michal@cihar.com>
* Version: $Id: setup.php,v 1.23.2.10.2.4 2006/08/22 17:36:34 lem9 Exp $
* Date: Mon, 18 Sep 2006 16:40:23 GMT
*/
/* Servers configuration */
$i = 0;
/* Server localhost (config:root) [1] */
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
/* End of servers configuration */
?>
MySQL 5.0.24b2:
The installation can be done following the Readme.os2 or
with my REXX script and a manual change of the my.cnf file
(this file HAS TO BE stored in \MPTN\ETC).
With my variant you can get around some stunts to get it working
(e.g. you don't need SED and a Unix Shell).
compress
user=root
[mysqld]
user=mysql
basedir=D:/OS2TOOLS/Datenbanken/mysql5
datadir=E:/DBDATA/MySQL5Data
basedir = The base directory of the MySQL5 installation.
datadir = The directory where the MySQL5 database files can be found.
I always another path for the data to make smaller backups (just data)
and not the complete installation. The data changes while the installation (the program)
doesn't change at all.
My REXX script to create the MySQL 5.0.xx tables should be available here:
REXX-Scripts
Extract the ZIP archive into the directory ".\mysql5\bin" and call it as shown in the following example:
- mysql_create_system_tables.cmd verbose
or - mysql_create_system_tables.cmd verbose d:\dbdata\mysql5data
In the first example the data directory for the databases will be created
in the MySQL installation directory (.\mysql5\data) and in the second
example it will be created in "d:\dbdata\mysql5data".
Don't forget to enter the correct path of "datadir" in the
my.cnf file. If it's wrong MySQL (mysqld.exe) doesn't find the
data directory, except you use a parameter to point mysqld.exe to the
correct location.
That should be all you have to do.
Den MySQL Daemon startet man mittels ".\mysql5\bin\mysqld.exe".
Um zu prüfen ob es klappt einfach den MySQL Client aufrufen ".\mysql5\bin\mysql.exe".
Der MySQL Client sollte sich mit "mysql> " und einem blinkenden Cursor melden.
Wenn nicht dann gibt es eine entsprechende Fehlermeldung. Verlassen kann man den MySQL Client durch Eingabe von "\q" (ohne die Anführungszeichen) und einem ENTER um den Befehl auszuführen.
Starting the applications
Um den Apache2 zu starten das angepaßte Startskript im Apache2-Basisverzeichnis aufrufen (".\Apache2\startup.cmd"). Für MySQL ist wie zuvor schon erwähnt der MySQL Daemon zu starten (".\mysql5\bin\mysqld.exe").
Final test
Eigentlich sollte man über die IP des Rechners (als Beispiel "192.168.27.1") nun in der Lage sein die Installation zu testen.
Hat man phpMyAdmin im sogenannten Wurzelverzeichnis für HTML-Dokumente (DocumentRoot - siehe "httpd.conf" entpackt), kann man phpMyAdmin wie folgt aufrufen:
http://192.168.27.1/phpmyadmin-2.8.2.4
Jetzt kann man wie in der Anleitung beschrieben auch leicht die Datenbank "phpmyadmin" anlegen/aktualisieren indem man über den Webbrowser in der phpMyAdmin-Oberfläche ("SQL") die passende "*.sql" Datei hochlädt. Diese wird dann automatisch ausgeführt und die Datenbank kann dann aus der DropDown-Liste ausgewählt werden.
Um die PHP Funktionalität einfach zu testen kann man die folgende HTML-Datei (hier "testit.html" genannt) mit diesem PHP-Code anlegen.
testit.html<head>
<title>PHP-Test </head>
<body>
<?php phpinfo(); ?>
</body>
</html>
Die Datei wird hier als Beispiel wieder im Wurzelverzeichnis für HTML-Dokumente gespeichert.
Aufgerufen wird sie dort über den folgende URL:
http://192.168.27.1/testit.html
Fehler werden in der Logdatei des Apache2 (siehe ".\Apache2\logs\") gespeichert.
Ein möglicher Fehler, den ich zunächst hatte war, das die PHP-Module für den Datenbankzugriff nicht geladen werden konnten.
Ich hatte in der PHP.INI den Parameter "extension_dir" zunächst nicht gesetzt und wurde an der falschen Stelle gesucht, die in der Logdatei angezeigt wird.
So ich hoffe das war ausführlich genug damit es jeder hinbekommt und ich hoffe ich habe keinen Fehler eingebaut (bzw. etwas wichtiges weggelassen).
Juergen