menembus batas impian

install php on slackware


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.bz2

Change to the PHP top directory:
cd /usr/src/php-5.2.13

Configure 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 install

Now, 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.ini

The 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 .php

While you’re there, you may want to add .php indexes to the DirectoryIndex line:
DirectoryIndex index.html index.php index.shtml

To make it all work, stop the web server:
/etc/rc.d/rc.httpd stop

Then start it again:
/etc/rc.d/rc.httpd start

Back to Stu’s Linux page

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: