PHP DevCenter
oreilly.comSafari Books Online.Conferences.


PHP Admin Basics

Basic Installation of PHP on a Unix System


The configuration system that PHP uses for installation is one of those nice, simple things in life that makes it rosy. At first it might seem a little confusing, but it's really very easy. So let's dive right in.

To download PHP, visit the download page and click the link under the heading "Complete Source Code."

The first thing to do after downloading and unpacking your source archive is to kick the tires a little bit.

You can unpack the archive using:

gunzip php-x.x.x.tar.gz;
tar xvf php-x.x.x.tar

(Substitute x.x.x for the actual version number of the php archive you downloaded.)

After which, you should see a directory called php-x.x.x, where x.x.x is the version number or some variation thereof. Then, cd into this directory and type:

./configure --help | more

to get a list of all available configuration options. The first few lines of output should look something like this:

Usage: configure [options] [host]
Options: [defaults in brackets after descriptions]
--cache-file=FILE cache test results in FILE
--help print this message
--no-create do not create output files
--quiet, --silent do not print "checking..." messages
--version print the version of autoconf that created configure

Also this week:

Achieving Low-Latency Response Times Under Linux

LAMP Lighter: The Apache Toolbox

Exploring the /proc/net/ Directory

BSD Tricks: Linux Compatibility, the Hard Way

Before compiling PHP you must first decide whether you're going to install it as a CGI binary or as an Apache module. I'll discuss compiling as an Apache module, as the two are virtually identical.

Next you must decide what additional PHP modules you wish to have built at compile time. An example of these modules might be mCrypt or FTP. I'll use these two as examples, but there are many more available. A complete list of supported modules can be found in the PHP documentation or by executing the above configure command.

To configure PHP with the mCrypt and FTP modules built in, type the following command:

./configure --with-apache=/tmp/apache_1.3.12 --with-mcrypt --with-ftp

Here I use /tmp/apache_1.3.12 as an example. You should replace it with the actual location of your Apache source. The configuration script will now go through a series of checks to see what you have installed on your system. If something the compiler will need is missing, it will let you know of your grievous error and stop abruptly with an error like:

configure: error: Please reinstall libmcrypt - I cannot find mcrypt.h

This is the configuration system's way of telling you it loves you, but you only have twenty-four hours to save the earth. That, and it couldn't find the mCrypt libraries anywhere on your system. So, go download and install any necessary libraries.

Pages: 1, 2

Next Pagearrow

Valuable Online Certification Training

Online Certification for Your Career
Earn a Certificate for Professional Development from the University of Illinois Office of Continuing Education upon completion of each online certificate program.

PHP/SQL Programming Certificate — The PHP/SQL Programming Certificate series is comprised of four courses covering beginning to advanced PHP programming, beginning to advanced database programming using the SQL language, database theory, and integrated Web 2.0 programming using PHP and SQL on the Unix/Linux mySQL platform.

Enroll today!

Sponsored by: