TOC
Requirements:

Installing PHP

After installing the webserver, we need to install PHP it self. It will work together with the Apache webserver we just installed, to allow the webserver to process PHP documents and return the content to the client. To read more about how this works, have a look at the introduction chapters of this tutorial. In case you started Apache before, close it down now - otherwise, the PHP installer might not be able to modify the required files!

PHP should always be downloaded from php.net, from the download page: http://www.php.net/downloads.php. This tutorial is based on PHP 5, so you should get the latest stable version of PHP 5 for Windows. Select the installer under "Windows binaries". You will get a list of mirrors which should be close to you. Pick one and download the file.

Start the installation, and proceed through it. You will be asked for a location to install to - the default is fine, although you may select another path if you wish too. The first interesting screen will look like this:

You should select the server that best fits the one you just installed. In my case, I have selected Apache 2.2.x module, because I just installed Apache 2.2.4. In the next screen, you will be asked to tell PHP where the Apache configuration files are. Use the browse button to find it. Unless you changed it while installing Apache, it will be something like C:\Program Files\Apache Software Foundation\Apache2.2\conf\. Once you get to the next screen, you will be asked which parts of PHP to install. All the extra extensions have been disabled by default, but since you might need them later on, and since diskspace is rarely a problem, you might wish to select them as well. I have decided to install all the stuff, so my screen looks like this:

Now go on. Once the installer is done copying files, it will ask you whether or not to install PHP in Apache. You should select Yes. It will update a couple of Apache configuration files, and you should be good to go. Next on is the MySQL installation, but if you feel like testing PHP, go on to the Hello world chapter for our first example of PHP code.


This article has been fully translated into the following languages: Is your preferred language not on the list? Click here to help us translate this article into your language!