First Step: Install and Configure PHP
- Download PHP from http://www.php.net/downloads.php
- Create a directory for php on your machine, i.e. c:php
- Extract the downloaded binary to a temporary location and then copy all the files from the unzipped directory to your c:php directory.
Note: the above steps for PHP version 4.X, there might be slight change in other versions.
Second Step: Configure Your Apache Server
- The first thing you will need to do is to load php as a module so it’s able to parse php. Script changes should be made in the httpd.conf file, typically found in the directory “C:Program FilesApache GroupApacheconf”. Search for the “LoadModule” statement and add the following directly after it:
LoadModule php4_module “c:/php/php4apache.dll”
Note: If you are using apache version 2.X then use “c:/php/php4apache2.dll” instead of “c:/php/php4apache.dll”.
- Now search for “AddType” in the conf file and at the end of the AddType statement add the following:
AddType application /x-httpd-php .php
- If you wish to use index.php as the default page for a directory, search for “DirectoryIndex” and change the line that says
“DirectoryIndex index.php index.html”
- Create a test php file to test the installation. Use the following php code in the test file:
Save this file as “phpinfo.php” and store it in your apache htdocs directory.
- Restart the apache server and type
in your browser to check to see if it is configured properly.