Installation and Configuration
PHP works with many different web servers in many different ways, but by far the most popular way to run PHP is as an Apache module with Apache 1.3.x. Full installation instructions for all the different ways to install PHP can be found in the PHP documentation. Here, I cover the Apache module installation.
If you are compiling from the PHP source tarball, follow the instructions in the INSTALL file found inside the PHP distribution file. A tarball is a compressed tar file. tar stands for tape archive, but these days it has little to do with tapes. It is simply a way to lump multiple files and directories into a single file for distribution. Normally tarballs have the .tar.gz extension to indicate a tar file compressed with gzip. To untar a tarball, use:
tar zxvf foo.tar.gz
On Windows, many utilities (including WinZip) understand tarballs.
If you are installing from a precompiled binary package such as an rpm file, most of the work should be done for you. But doublecheck that the Apache configuration described below is correct.
When you are using PHP as an Apache module, PHP processing is triggered by a special MIME type. This is defined in the Apache configuration file with a line similar to:
AddType application/x-httpd-php .php
This line tells Apache to treat all files that end with the .php extension as PHP files, which means that any file with that extension is parsed for PHP tags. The actual extension is completely arbitrary and you are free to change ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access