This simple extract shows how to run PHP as an Apache module on windows with just 4 lines of code. PHP configuration will be covered in another article. You will need the following set up to try this at home.
Requirements:
Steps:
Once these tasks have been completed you should have Apache running as a service and all files will be located in X:\Program Files\Apache Group\Apache2 - X being your default hard drive.
You can really extract PHP to any location you wish, but in this example I have extracted php-5.2.0-Win32 to the following directory: X:\Program Files\Apache Group\php\php-5.2.0-Win32.
Next step is to open up your httpd.conf file in a text editor, wordpad or notepad, and add a few lines. The file, from the default installation is found in the X:\Program Files\Apache Group\Apache2\conf folder.
Do a search from "LoadModule" and you will see a list of modules that Apache tries to initiate when starting up. At the foot of this section, add the following 4 derivatives - each on a separate line: LoadModule; PHPIniDir; AddType; second AddType.
LoadModule php5_module "X:/Program Files/Apache Group/php/php-5.2.0-Win32/php5apache2.dll"
PHPIniDir "X:/Program Files/Apache Group/php/php-5.2.0-Win32"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
That's it. Left-click the Apache monitor icon that should be in your task-bar and press restart. You can create a php page to test if the installation has worked. Save the following as info.php in your X:\Program Files\Apache Group\Apache2\htdocs folder assuming you haven't modified your document root.
<?php
phpinfo();
Open up http://localhost/info.php in your favorite web browser. You should now see your PHP information nicely displayed on screen. You will notice some irregularities on the page, but that will be covered in the next article.