We now have a youtube channel. Subscribe!

PHP Configuration in Apache Server

PHP Configuration in Apache Server


Hello folks! Welcome back to a new edition of our tutorial on PHP. In this tutorial guide, we will be studying about how to configure PHP in Apache server.

Apache uses 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:

Timeout

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

DocumentRoot appoints the root directory for all HTTP processes on that server. It looks like this on Unix -

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

You can choose any directory as root document.


AddType

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

Action

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

AddModule

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

AddModule mod_php4.c


Alright guys! This is where we are rounding up for this tutorial post. In our next tutorial guide, we are going to be discussing about the PHP.INI file configuration.

Feel free to ask your questions where necessary and we 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.

Post a Comment

Hello dear readers! Please kindly try your best to make sure your comments comply with our comment policy guidelines. You can visit our comment policy page to view these guidelines which are clearly stated. Thank you.
© 2023 ‧ WebDesignTutorialz. All rights reserved. Developed by Jago Desain