PHP Configuration in Apache Server
Hello dear readers! welcome back to another section of my tutorial on PHP. In this tutorial guide, we will be discussing about how to configure PHP in Apache server.
Apache makes use of httpd.conf file for global settings, and the .htaccess file for pre-directory access settings. Older versions of Apache split up the httpd.conf into three different files (access.conf, httpd.conf, and the srm.conf), and some developers still prefers this arrangement.
Apache server has a very powerful, but slightly complex configuration system of its own. Learn more about it from the official Apache website.
This tutorial describe settings in httpd.conf that has a direct impact on PHP and cannot be set elsewhere. If your installation is standard, then httpd.conf is going to be found at /etc/httpd/conf:
This value sets the default number of seconds before any HTTP request will time out. If you set the PHP’s max_execution_time to be longer than this value, then PHP will keep grinding away but the user may see a 404 error. In safe mode, this value will be ignored; you must make use of the timeout value in php.ini.
DocumentRoot appoints the root directory for all HTTP processes on that server. It looks like this on Unix -
You can choose any directory as root document.
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 .phtml, .php5, .php7 or .html.
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 the shared object support -
LoadModule php4_module modules/php4apache.dll
or on Unix flavors -
LoadModule php4_module modules/mod_php.so
You must uncomment this line for static module version of Apache.
Alright guys! This is where we are rounding up for this tutorial post. In my next tutorial post, we are going to be discussing about the PHP.INI file configuration.
Feel feel to ask your questions where necessary and i will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.
Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.
Thanks for reading and bye for now.
Originally published at https://www.webdesigntutorialz.com.