View ToC

PHP 7 - Apache Configuration

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

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

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


This 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 grinding away but the user may see a 404 error. In safe mode, this value will be ignored; instead, you must use the timeout value in php.ini.


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

DocumentRoot ./usr/local/apache_2.4.0/htdocs.

You can choose any directory as the document root.


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 php7_module modules/php7apache2_4.dll

on Unix flavors −

LoadModule php7_module modules/


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

AddModule mod_php7.c