Configuring Apache

After you have compiled PHP and Apache, you should check Apache’s configuration file, httpd.conf, which you will find in a directory called conf in the Apache install directory. Add the following lines to this file:

						AddType application/x-httpd-php .php
					

This ensures that the PHP engine will parse files that end with the .php extension.

If you want to offer to your users PHP pages with extensions more familiar to them, you can choose any extension you want. You can even ensure that files with the .html extension are treated as PHP files with the following:

AddType application/x-httpd-php .html

Note that treating files with the .html extension as PHP scripts could slow down your site because every page with this extension ...

Get Sams Teach Yourself PHP in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.