Configure Apache to run PHP on Windows

Just rebuilt my Windows laptop and had to reload Apache, MySQL and PHP. Some may suggest WAMP or XAMPP projects to simplify things, but those are my last resorts. I like to have full control of the situation. So I downloaded the latest versions of each from respective site and installed them. And then the problem happened.

PHP installed successfully but had an error that it could not access httpd.conf so PHP files could not be executed. To get the short answer, I turned to Google. It took me about 10 minutes and sorting of 20 webpages to get to the right configuration. Only if I had gone directly to Apache it would be better. But here is what configuration in Apache has to be done to get PHP files recognized and run by Apache.

Modify httpd.conf file to have following.

# Tell Apache where to pick PHP Module from
LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"

# Tell Apache that it should treat index.php just like index.html
DirectoryIndex index.html index.php

# Add type for PHP file handler
AddType application/x-httpd-php .php
# This is optional but allows user to access php source file (php files with extension  renamed) with full syntax highlighting
AddType application/x-httpd-php-source .phps