By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

Installing PHP with Apache on Windows

How to install PHP when running apache on Windows.

Edited: 2015-12-03 13:06

This Tutorial shows how to install PHP after installing apache on windows. I'm going to use the msi installer in this Tutorial, you can get it from the PHP download page

Installing PHP

I used the php-5.2.6-win32-installer.msi for this tutorial, but it should also work with new versions. Start by chosing a installation folder for PHP, i recommend c:\PHP\ for now.

Web Server Setup

Select the Web Server you wish To setup.

Simply chose the version you installed, if you followed the last Tutorial, then this is likely to be the Apache 2.2.x Module.

Apache Configuration Directory

Browse to select the directory containing the Apache Configuration Files

Chose the Conf directory in the installation folder of Apache.

I.e c:\Apache\conf\

Chose Items to Install

Simply chose the Extensions you need, and complete the installation. If you want to install MySQL later then i recommend you chose this extension. You may want to chose GD library to get access to the image function in php, this is called GD2 in the extensions list.

Seeing if it Works

Create a filename.php in your htdocs and enter the below code.

echo phpinfo();

To see if it works, enter the URL for the file in your browser.

I.e. http://localhost/filename.php

As a final step i recommend that you add index.php as the Directory Index, simply open httpd.conf and search for DirectoryIndex, change this line to index.php

The next Tutorial is Installing MySQL with Apache on Windows