How to Install PHP on Windows


If you want to setup a local server and develop PHP based websites or web applications, you will need to install PHP module on your computer. This post will demonstrate how to do that.

PHP is a very popular server-side scripting language that allows you create dynamic websites and functional applications. Over the years, it has become very powerful and it is now used by millions of web developers worldwide.

In a previous post, I talked about how to install Apache on Windows and I guess you already know that you should have either Apache or another web server software installed on your computer, so that you can work with PHP. See that post if you need help with installing Apache.

Whether you will work locally (on localhost) or connect to the Internet with your web server, by installing PHP, you will be able to test and run your PHP scripts and applications without uploading the files to your hosting. This absolutely makes things a lot easier and faster. If you are new to PHP, I highly recommend you go through PHP basics on various resources after installing PHP. You can also check, the official website, to learn more about PHP programming.

At this point, I will assume that you have installed a web server (i.e. Apache) on your computer, it works correctly and you are ready to download and install PHP. Firstly, make sure that Apache is not running, close it if it is active. Secondly, you should choose which version of PHP to download.

Which PHP Version to Download: VC6 or VC9?

The latest stable PHP version is 5.3.8 and if you want to work with that version of PHP, your Apache version should be compatible with that build. PHP 5.3.8 is based on VC9 (Visual Studio C++ 9 runtime libraries) but unfortunately, Apache doesn't have an official build that is compatible with VC9. That's why you should install the Apache from if you want to work with the latest PHP version. I personally installed this build of Apache and PHP 5.3.8 VC9 and I will continue assuming that you chose that builds as well.

PHP 5.3.8 Thread Safe or Non Thread Safe?

When you visit the download page of PHP here, you will notice that there are two builds, Non Thread Safe and Thread Safe. Thread Safety is related to the multiprocessor systems, which can divide instructions into multiple pieces and process them in that way. This is an advanced topic and you really don't need to bother with it if you are just beginning with PHP. If you are working on Windows system and have Apache installed, you have one option which is to go with the Thread Safe version. Let's continue with the downloading.

Download PHP

Go to and find PHP 5.3.8 VC9 x86 Thread Safe (2011-Aug-23 12:01:10). Download the installer file.

PHP Download

Once the download is complete, run the installation file. You will see a Welcome window, click Next. On the second window, there will be a license agreement, read it and accept it. The next step is to choose a destination folder for PHP. You can choose the destination folder wherever you want, but know that it is recommended not to put PHP folder in Program Files, since there is an empty space in "Program Files" folder name.

PHP Destination Folder

On the next window (Web Server Setup), select Apache 2.2.x Module.

PHP Web Server Setup

On the next window (Apache Configuration Directory), locate the conf folder in the Apache folder.

PHP Apache Configuration Directory

On the next window (Choose Items to Install), you can choose what features you want to be installed or not. If you don't have any idea about them, just leave it as it is and it will be fine. Click Next and then Install. After the installation is complete, check if it is working. Start Apache server and double click on the system tray icon. If you see a note about PHP on the status bar of the Apache Service Monitor, that means it is working correctly.

Apache Service Monitor

If you don't see that PHP note, please check all the installation steps once more. You could also try uninstalling the Apache server and installing it again following the instructions in this post.

Another way to test whether PHP is working or not is to use the phpinfo() function. Create a PHP file (such as php-info.php) and insert this code into it:


Put the file into the htdocs folder in the Apache folder. Now, open a browser and type the following in the address bar:


If everything is ok, you should see a page full of information about your PHP module. One thing I should mention is that if you want to make errors visible while you are testing your scripts, you should open the php.ini file (you will find it within PHP folder) and set the display_errors option to On.

f t g+ in