/*  UberLinux.org - Procedures - PHP */

Welcome to storm.uberlinux.org
Linux Mandrake release 7.0 (Air)
Kernel 2.2.14-15mdksecure on an i586
login:


home/
procedures/
>php/
stories/
archive/
links/
portfolio/
about/

>PHP Hypertext Preprocessor v4.3.3 www.php.net

This procedure will outline the installation and setup of the PHP Hypertext Preprocessor for most Linux systems. PHP is an HTML-embedded scripting language which allows web developers to write dramatically generated pages quickly. This procedure documents an upgrade to PHP version 4.3.3 under Apache version 1.3.9.

Assuming that the Apache webserver is running properly this a simple procedure. The first step is to create the download directory and download the source file. I have created the directory /etc/php for this purpose. If you are recompiling remove the config.cache file before proceeding.

After downloading, the following steps will install php4 on your machine: 

  1. Make sure that Apache has mod_so enabled by issuing the httpd -l command. If it does, it will return a result like the following:

Compiled-in Modules:
http_core.c
mod_so.c

If it does not, please consult the INSTALL documentation in the distribution. The directions are clear and easy.

  1. gunzip php-4.3.3.tar.gz to unzip the file
  2. tar -xvf php-4.3.3.tar to untar - this will create the directory  php-4.3.3. cd php-4.3.3 to change to this directory.
  3. ./configure --with-mysql --with apxs. If you get an error for mysql or apxs, it will be necessary to enter the full path such as --with-mysql=/usr/local/mysql or --with-apxs=/usr/sbin/apxs. You can locate the file locations by issuing the find / -name <filename> command.
  4. make
  5. make install
  6. After installation it is necessary to copy the php.ini-dist to the /usr/local/lib/php directory. From within the /php-4.3.3 directory issue the cp php.ini-dist /usr/local/lib/php.ini command.
  7. Edit your httpd.conf file to load the PHP module. The path on the right hand side of the LoadModule statement must point to the path of the PHP module on your system. The make install from above may have already added this for you, but be sure to check. Mine reads LoadModule php4_module   /usr/lib/apache/libphp4.so.
  8. Beneath the LoadModule in the AddModule directives enter AddModule mod_php4.c.
  9. Apache needs to parse certain extensions as php so in the AddType configurations enter AddType application/x-httpd-php .php .phtml. I also configured Apache to show highlight php source by entering the following on the next line: AddType application/x-httpd-php-source .phps.
  10. Make sure to comment out (#) or delete any prior php modules etc. I ran into errors on the second install because of this.
  11. The last step is to make sure that the PHP 4 mime type line is uncommented in the httpd.conf file.
  12. Stop and then start, do not restart, the Apache webserver and you should be able to serve PHP files now.

I made a test file with the tag <?phpinfo()?> and when working properly will return a result like the following http://www.uberlinux.org/test.php


Last login: Thu July 17 16:06:33 from uberlinux.org
********************
Hello. Welcome to Storm!
********************
[chris@storm chris]$

home/    procedures/    stories/    archive/    links/    portfolio/    about/

Last Updated 10/11/2006

Copyright 2003-2006 uberlinux.org