Configure Apache for PHP

Admin   PHP   675  2020-09-07 23:13:37

Apache uses the httpd.conf file for global settings, and the .htaccess file for per-directory access settings. Apache versions divide httpd.conf into three files (access.conf, httpd.conf, and srm.conf), and some users still prefer this arrangement.

Apache Server has a powerful and less complex configuration system. You can learn more about it at:

The following section describes the settings in httpd.conf that affect PHP directly and cannot be set elsewhere. If you have a standard installation, then httpd.conf should be found at /etc/httpd/conf.

Timeout value

This value sets the default number of seconds before any HTTP Request will timeout. If you set PHP's max_execution_time to a value longer than this value, the user will see a 404 error. In safe mode, this value will be ignored; you must use the timeout value in php.ini instead.


DocumentRoot specifies the Root Directory for all HTTP processes on that server. It looks like the following on Unix.

DocumentRoot ./usr/local/apache_1.3.6/htdocs.

You can choose any directory as DocumentRoot.


The PHP MIME type needs to be set here for the PHP file to be parsed. Remember, you can associate any file extension with PHP, for example .php3, .php5 or .htm.

AddType application/x-httpd-php .php
AddType application/x-httpd-phps .phps
AddType application/x-httpd-php3 .php3 .phtml
AddType application/x-httpd-php .html


You must uncomment this line to the Windows apxs module version of Apache:

LoadModule php4_module modules/php4apache.dll

Or on Unix:

LoadModule php4_module modules/


You must uncomment this line for the Apache Static Module Version.

AddModule mod_php4.c