pdf icons

Binding PHP to Apache

Configuring PHP to work with Apache:

To bind Apache and PHP (configure apache and php) together a few changes have to be made in Apache’s httpd.conf.

Apache’s httpd.conf file is normally found in:c:\Program Files\Apache Software Foundation\Apache2.2\conf sub-directory.

These are the entries that have to be made in Apache’s httpd.conf file.

Locate the IfModule mime_module section in the httpd.conf file

Below the AddType application/x-gzip .gz .tgz add another entry as shown in Diagram 1.

AddType application/x-httpd-php .php

Take a look at the diagram below it could help you out

diagram1 Diagram 1

Within Apache’s httpd.conf file locate the PHP LoadModule section, and add another LoadModule entry.

LoadModule php5_module “C:/php/php5apache2_2.dll” as shown in Diagram 2.

Take a look at the diagram below it could help you out

diagram2Diagram 2

Apache and PHP have been configured to work together

System settings in Windows XP – Path

Right click My Computer icon on the desktop and go to Properties. System Properties window open as shown in Diagram 3.

My Computer > Property > Advance > Environment Variable > System Variable > Path, and add C:\php; as shown in Diagram 5 ;

diagram3 Diagram 3

diagram4 Diagram 4

diagram5 Diagram 5

System settings in Windows XP completed

Testing the Apache and PHP relationship

Using any ASCII editor create a file named phpinfo.php

The content of this file is a single line of code: <?php phpinfo(); ?> (type the line exactly as shown)

Place this file in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs

Restart Apache. Apaches Icon will be displayed in the Window’s task bar. It’s the first icon in the image below, with the tiny green triangle as shown in Diagram 6

diagram6 Diagram 6

Simply double click this icon and from the Apache service monitor select ‘Restart’ as shown in Diagram 7

diagram7 Diagram 7

Execute the phpinfo.php file using any browser by typing in the following in its Address bar.

The following as shown in Diagram 8 should be displayed in the Browser window. This indicates that Apache and PHP are working together just fine

diagram8 Diagram 8

Apache and PHP have been installed and configured and tested successfully.

April 15, 2016
Design by Ivan Bayross and Meher Bala © 2017 All Rights Reserved