Recipe 2.5 Installing mod_php on a Unixish System


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


Download the mod_php package source from the web site at (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.


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

  • Recipe 8.15

  • Recipe 8.16


Apache Cookbook
Apache Cookbook: Solutions and Examples for Apache Administrators
ISBN: 0596529945
EAN: 2147483647
Year: 2006
Pages: 215

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: