Configuration of Apache Web Server for PHP

Apache server uses httpd.conf for Global Setting while .htaccess file for directory access settings. Previous editions of Apache break up httpd.conf into three files (access.conf, httpd.conf, and srm.conf). Some developers still prefer this.

Apache server has powerful, but slightly complex, configuration system of its own. Learn more about it at the Apache Web site:

The next part explain settings in httpd.conf that change PHP directly and can’t be set elsewhere. If you have standard installation then httpd.conf will be found at /etc/httpd/conf:


The Timeout value sets the default number of seconds before any HTTP request will time out. If you set PHP’s max_execution_time to longer than this value, PHP will keep executing but the user may see a 404 error. In safe mode, however this value will be ignored; you have to use php.ini timeout value instead.


DocumentRoot defines the root directory for all HTTP processes on that server. It looks something like this on Unix:

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


The PHP MIME type needs to be set here for PHP files to be parsed. {Remember that you can associate any file extension with PHP like .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 for the Windows apxs module version of Apache with shared object support:

LoadModule php4_module modules/php4apache.dll

or on Unix flavors:

LoadModule php4_module modules/


You must uncomment this line for the static module version of Apache.

AddModule mod_php4.c

Was this article helpful?

Related Articles

Leave A Comment?