Installing PHP
This section explains how to install PHP 4 (versions later than 4.3) or PHP 5 as a shared module in Apache 2:
Once you have installed Apache, you can install the shared PHP module as part of the web server. Login in as the root user.
Get the latest version of PHP from http://www.php.net/downloads.php. Download the "Complete Source Code" version into the /tmp directory. Do not download any version earlier than PHP 4.3.0, as this will not work with the latest version of Apache 2. This book uses PHP 4.3.3 and PHP 5.0.0 beta, and we recommend installing the latest stable version at the time of writing.
Choose an installation directory. If the Apache installation was begun in /usr/local/, the same location can also be used for PHP. Move the PHP source code file to the base directory of the desired installation. Assuming this is /usr/local/src and, assuming the distribution downloaded is PHP 4.3.3 and it was downloaded into the /tmp directory, the command is:
%
mv php-4.3.3.tar.gz /usr/local/src
After moving the distribution to the desired location, change directory to that location using:
%
cd /usr/local/src
Uncompress the package in the new installation directory by running:
%
gzip -d php-
version_number.tar.gz
If the version downloaded is PHP 4.3.3, the command is:
%
gzip -d php-4.3.3.tar.gz
Un-
tar
the distribution by running:%
tar xvf php-
version_number.tar
A list of files extracted is displayed. If the version downloaded is PHP 4.3.3, the command is:
%
tar xvf php-4.3.3.tar
Change ...
Get Web Database Applications with PHP and MySQL, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.