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-5.2.3%./configure \>--with-apxs2=%/usr/local/apache/bin/apxsmake#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>
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. If you do, indicating a successful installation, remove the info.php file.
There are numerous additional options and extensions available for PHP; the recipe given here is only for the most basic installation.
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