I) What you need
- A Slackware Linux box on which you can log on as root.
- The Apache web server must be installed with mod_so enabled. (For more information, see my Apache install directions.)
- Some type of Internet access (to download the PHP source).
- About half an hour of uninterrupted work time.
II) Downloading PHP
You can download from one of the PHP mirrors. (PHP comes in both gzip and bzip2 archives. This document assumes the bzip2 type.)
NOTE: PHP 5.3 is out. I'm still using 5.2, due to issues with some of the Drupal modules we use.
In bzip2 form, PHP 5.2.x is around 9 MB, so if you're using dial-up this will take a while.
As of the time of this writing, the current 5.2.x branch PHP is version 5.2.13, so the file you get is called php-5.2.13.tar.bz2 or something similar.
Just store this somewhere that Linux can see it.
III) Installing PHP
cd to wherever you want the PHP source to live and extract it:
cd /usr/src
tar jxf /where_php_tarfile_is/php-5.2.13.tar.bz2Change to the PHP top directory:
cd /usr/src/php-5.2.13Configure PHP:
(This assumes that Apache is installed in /home/httpd. If it's not there, you'll need to figure out where apxs lives.)
./configure --with-mysql --with-apxs2=/home/httpd/bin/apxs(NOTE: Apache must be installed with mod_so enabled.)
Assuming there are no error messages from configure, it's time to make and install PHP. Just type:
make ; make installNow, we need a php.ini file to tell PHP how to act. I just use php.ini-recommended with one change.
First, put php.ini in the default location:
cp php.ini-recommended /usr/local/lib/php.iniThe only change I make is to turn off allow_url_fopen:
allow_url_fopen = Off(NOTE: In the wrong hands, allow_url_fopen can be very dangerous! I write PHP code to avoid its use.)
All that's left to do is modify the Apache configuration file: /home/httpd/conf/httpd.conf by adding the line:
AddType application/x-httpd-php .phpWhile you're there, you may want to add .php indexes to the DirectoryIndex line:
DirectoryIndex index.html index.php index.shtmlTo make it all work, stop the web server:
/etc/rc.d/rc.httpd stopThen start it again:
/etc/rc.d/rc.httpd start