Configuring Apache to run PHP on windows xp ,7 in 3 Easy Steps
- Apache web server installed for a detailed installation refer Installing Apache Server on Windows 7 or xp for php on windows guide
- PHP Installed on windows machine we assume that php is installed under c:\php\ for a different directory change it appropriately.
There are types of configuration where apache can handle php pages one is through the apache module which you can think as very much integrated with apache httpd server second is via a cgi binary php-cgi.exe
Installing Apache as a APACHE MODULE
Open the httpd.conf file located at “c:\Apache2\conf\httpd.conf” and just add these lines where the keywords match for example LoadModule will go where similar LoadModule directives are there, you can just use the text editors find command to get these directives.
Step 1 : Module loading add this
LoadModule php5_module “c:/php/php5apache2.dll”
This is the Module that ships with default installation of php for Apache 2.2 .The modules are also renamed as php5apache2_2.dll you can just have a look in c:\php folder !
Step 2 : Adding a MIME Type
AddType application/x-httpd-php .php
The AddType adds a MIME header to files for browser and Apache to determine the file based on its extension so that when a file request comes for example.php Apache will first give it to php parser which will return a formatted html page
Step 3 :Add path to php.ini file
The PHP global configuration file to get all the values like maximum file upload size , include path etc to be jelled with Apache add this to the end of PHP’s php.ini file