Installing PHP on Windows 7 is quite a simple affair. However, as the more experienced developers would know, you need to have a web server running first. I suggest using the world's most popular web server - get instructions on how to install Apache on Windows 7 operating system. And if you are a budding PHP programmer, you would very soon like to use it with MySQL database. So once you have finished with PHP installation, read the steps to install MySQL on Windows 7.
Assuming you have successfully been able to install Apache on Windows 7 and have seen the "It works" page, download the PHP file from www.php.net. Though I am on a 64 bit Windows 7 system, I downloaded php-5.2.11-Win32.zip because PHP doesn't come in 64 bit flavour.
This tutorial will tell you how to install PHP from the zip archive and not from the installer file - [Slide 1]. Somehow, I've found this is a little simpler. So the first thing is to create a folder where you would like to unzip the PHP files. I like to keep things segregated and yet accessible. Giving PHP its own directory under the C: drive is what I generally do. So go ahead and create a folder called PHP in the C drive on your hard disk. Now unzip the contents of the downloaded PHP zip file into this folder - [Slide 2].
In this C:/PHP folder, you'll see a file called php.ini-recommended. Right-click on this file and choose Copy - [Slide 3]. Now paste the file in the same directory - [Slide 4].
Very important: Rename this file to php.ini. Windows will tell you that changing the extension will make it unusable - Ignore the message and continue - [Slide 5].
If you are seeing this text, you need to install the Flash player and turn JavaScript on in your browser.
Though you have been able to put PHP on your computer, it's still not "installed" in the true sense of the word. We have to help the Apache web server communicate with PHP. This is done by editing the Apache configuration file, httpd.conf. Go to All Programs -> Apache HTTP Server 2.2 -> Configure Apache Server -> Edit the Apache httpd.conf Configuration File. This opens httpd.conf file in Notepad - [Slide 6].
Gear up to make some changes to this file- check the screenshots from the slideshow as you go along.
Save the httpd.conf file - "File" -> "Save" [Slide 12] and restart your computer. You actually don't need to restart the machine; stopping and starting the Apache service would have probably worked but I needed a cup of tea.
It's now time to test whether PHP was properly installed on Windows 7. Open a Notepad window and type in the line below exactly as it appears - you can copy-paste if you want.
<?php phpinfo(); ?>
Save this file as phpinfo.php in the document root folder which should be C:/websites if you have followed by instructions above.
IMPORTANT: By default, Notepad will save the file as .txt. So you need to select "All Files" from the "Save as type" drop down and enter the full file name in the "File name" field. Confused? Check the screenshot - [Slide 13].
Open a browser window and load http://localhost/phpinfo.php. A long page with details of the installed PHP version should display - please refer the screenshot in the slideshow - [Slide 14]. If you don't get this and see the PHP code instead, you've probably not saved the file with a .php extension.
This completes the instructions on how to install PHP on Windows 7. I also advice going through the PHP configuration file (php.ini) and making modifications as required. We shall tackle this in the article on MySQL installation on Windows 7 - keep reading.
Page contents: Instructions on how to install PHP on your Windows 7 computer. Step by step instructions with screenshots.
Comments, questions, feedback... whatever!