CONFIGURING PHP 4, MySQL 3.22, PHPMyAdmin, gd FOR Apache 1.3.x UNDER LINUX

Denis Bourdon - Student at Telecom Grenoble, France
dbourdon@dbourdon.com - www.dbourdon.com/development

Last update: February, 12th 2001
Cette page est aussi disponible en français.


I. Installing Linux

 This configuration allows you to install PHP/MySQL (with PHPMyAdmin and gd) under the Web Server Apache ans the Linux Operating System; the distributions I use are Red Hat 7.0 (this configuration works with RedHat 6.0 and 6.2, and Mandrake 7.0 and 7.1 as well). I also contributed to install this on an IBM AIX Unix system.

 I advise you not to install the Web Server Apache during the installation of Linux, but to install it statically with PHP (and not as a module).


II. Installing MySQL

 For this application, I always use RPM packages, i.e. "MySQL-3.22.32-1.i386.rpm" and the client "MySQL-client-3.22.32-1.i386.rpm" in the usual way of installing them.


III. Installing gd

 Once again, I use RPMs to install this graphics library. Recent version support JPEG and PNG, and no longer GIF due to rights problems. To find the RPMs, go to www.rpmfind.net. When I install the Red Hat 7.0 with the "graphics manipulation " (not so sure!), gd is installed as well.


IV. Installing Apache and PHP

- First of all, download the latest source code of PHP 4 in tar.gz on www.php.net (select "downloads"); currently, the latest version is PHP 4.04pl1, but the installation will udoubtedly be the same for the following versions.

- Download the tar.gz source code of Apache on www.apache.org; currently, the version 2 is a beta, so I advise you to download the 1.3.12 version.

- Copy the files in a temporary folder ("/home//tmp/" for example).

- Decompress Apache with "tar xzvf apache_1.3.12.tar.gz" (here with GNU TAR) and configure it with : "cd apache_1.3.12", "./configure", "cd .."

- Decompress then PHP 4 with "tar xzvf php_4.0.4pl1.tar.gz" and configure it for its static use with Apache and for the support of MySQL and gd with : "cd php_4.0.4pl1", "./configure --with-mysql --with-gd --with-apache=../apache_1.3.12" (personaly, I add the support of XML with "--with-xml"), "cd .."

- Compile PHP 4 with: "make" et "make install".

- Go back to the Apache directory ("cd ../apache-1.3.12") and configure the installation with "./configure --prefix=/www --activate-module=src/modules/php4/libphp4.a". Two remarks: you can install Apache somewhere else by changing the parameter of "--prefix"; the file "src/modules/php4/libphp4.a" does not exist as it will be created during this installation.

- Compile Apache with : "make" and "make install".

- Now, copy the file to personalize PHP 4 in the Linux librairy: "cp ../php-4.0.4pl1/php.ini-dist /usr/local/lib/php.ini"; edit it to personalize your options.

- Edit the filer "/www/conf/httpd.conf" to set up Apache.

- Search the string "ServerName" and delete the eventual character "#" if it appears before "ServerName" (to make the line active). Your server name appears then.

- Search now "AddType application/x-httpd-php" and replace (if needed) the line you found by "AddType application/x-httpd-php .php" (I advise you to add the ".php3" extension to run old scripts with the PHP 3 extension).

- Search then "DirectoryIndex" and add "index.php" (and eventualy "index.php3") to allow a request of a directory containing such a file to be opened with this file.

- Finally, you can modify the directory where the server files will be found by modifying twice in the file the option "Directory"; personaly, I use a "/www/html" directory.

- If you are located on a NFS network, add in the other computers the nickname of your server (which must be the name of your computer in the network) in the file "/etc/hosts" with a line which looks like " 192.168.0.1 Foo" where you type your IP and the nickname of your server separated by a tabulation.

- Start Apache with"apachectl start".

- Pur an index.php in "/www/html" like this one:

<html>
<body>
<?
 echo "Hello world!";
?>
</body>
</html>

and check if it's up and running by launching "http://localhost/" in a browser.


V. Installing PHPMyAdmin - First of all, download PHPMyAdmin on www.phpwizard.net/phpMyAdmin/

- Install it in a subdirectory called 'phpmyadmin' above the directory which corresponds to your 'localhost'

- Edit 'config.inc.php3'; at the beginning of the file, fill the array $cfgServers[1] with your server attributes - it typically looks like the following one. The required values for your localhost access is in italic. The password is the root password of MySQL.

$cfgServers[1]['host'] = 'localhost';           // MySQL hostname
$cfgServers[1]['port'] = '';                    // MySQL port - leave blank for default port
$cfgServers[1]['adv_auth'] = false;             // Use advanced authentication?
$cfgServers[1]['stduser'] = 'root';             // MySQL standard user (only needed with advanced auth)
$cfgServers[1]['stdpass'] = '';                 // MySQL standard password (only needed with advanced auth)
$cfgServers[1]['user'] = 'root';                // MySQL user (only needed with basic auth)
$cfgServers[1]['password'] = 'rootpassword';                // MySQL password (only needed with basic auth)
$cfgServers[1]['only_db'] = '';                 // If set to a db-name, only this db is accessible
$cfgServers[1]['verbose'] = '';                 // Verbose name for this host - leave blank to show the hostname

- To install foreign languages dictionnaries, check for the file 'your_language.inc.php3' in the PHPMyAdmin directory. Search in the 'config.inc.php' for the string 'require("english.inc.php3");' and replace it with 'require"your_language.inc.php3"'.

- Run it by browsing 'http://localhost/phpmyadmin/'