Installation and Configuration

PHP Version 3 can be installed in two primary ways: as an Apache module on Unix systems or as a CGI script on both Unix and Windows systems. See the installation instructions that come with PHP for full and current information.

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

This tells Apache to treat all files that end with the .php3 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 it to whatever you wish to use.

If you are running PHP as a dynamic shared object (DSO) module, you also need this line in your Apache configuration file:

LoadModule php3_module
    modules/libphp3.so

When you are running PHP as a CGI script (with any web server), PHP processing is still triggered by this special MIME type, but a bit more work is needed. The web server needs to know that it has to redirect the request for the PHP MIME type to the CGI version of PHP. With ApacheNT, for example, this redirect is done with a set of configuration lines like the following:

ScriptAlias /php3/ "/path-to-php-dir/php.exe" 
AddType application/x-httpd-php3 .php3
Action application/x-httpd-php3 "/php3/php.exe"

For IIS, this redirect is set up through the Windows registry. Refer to the PHP installation instructions for ...

Get PHP Pocket Reference 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.