Installing PHP with Slackware Linux
Stuart Reedy, stu@coe.uky.edu
v1.07, March 29, 2010
Copyright Stuart Reedy 2003-2010
This document is intended to be a cookbook install of PHP under Slackware Linux. It assumes that you've installed Apache web server using my instructions.
I) What you need
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/srcChange 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.)
(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 startlast updated 03-29-2010 07:17
Copyright Stuart Reedy 2003-2010
All rights reserved