DekGenius.com
[ Team LiB ] Previous Section Next Section

Recipe 2.5 Installing mod_php on a Unixish System

Problem

You want to add the mod_php scripting module to your existing Apache web server.

Solution

Download the mod_php package source from the web site at http://php.net/ (follow the links for downloading) and unpack it. Then:

% cd php-4.3.2 
% ./configure \ 
>     --with-apxs= /usr/local/apache/bin/ apxs 
% make 
# make install 

Restart the server.

Discussion

To test that your installation was successful, create a file named info.php in your server's DocumentRoot; the file should contain the single line:

<?php phpinfo(  ); ?>

Add the following lines to your server's httpd.conf file:

<IfModule mod_php4.c>
    AddType application/x-httpd-php .php
    AddHandler application/x-httpd-php .php
</IfModule>

After restarting your server, try fetching the document info.php using a browser. You should see a detailed description of the PHP options that are active.

There are numerous additional options and extensions available for PHP; the recipe given here is only for the most basic installation.

See Also

    [ Team LiB ] Previous Section Next Section