How to Install PHP

Installing PHP on local pc allows you to safely create and test a web site or application and then move it to live website. So what you need to start running PHP on Windows platform?

  • install a web server (Apache, IIS )
  • install PHP
  • install a database, such as MySQL

The official PHP website ( has installation instructions for PHP:

All-in-One packages

There are some Windows distributions,  contain Apache, PHP, MySQL that  allow you to install with one package.

Manual Installation

Step 1.  Install MySQL
Download the ‘MySQL Installer for Windows’ from , run installation and follow instructions.

Step2. Install Apache
Download Apache binaries version for your system from .    Unzip the file into C:\.   You should end up with a directory ‘Apache24’ (or whatever the latest version is).   Run Command Prompt as Administrator. Enter

cd \Apache24\bin
httpd -k install
httpd -k start

To test it worked type ‘http://localhost’ into your browser. You should get a screen up to the effect that Apache is installed and working.

Step3. Install PHP
Go to In the current stable release section click on link for Windows 5.x.x binaries and source. Download ‘Zip’ for VC11 x86 Thread Safe.
Open the zip file and extract to C:\PHP\

Step 4. Configure Apache and PHP
Time to edit Apache’s httpd.conf file. In the file explorer navigate to C:\Apache24\conf\httpd.conf. Open it in Notepad . At the end of this file add the following lines:

LoadModule php5_module "C:/PHP/php5apache2_4.dll"
AddHandler application/x-httpd-php .php

The version of the module file matters (2_4 in this case). It MUST match the Apache version installed.
In the same file. Search for the line starting DirectoryIndex. Change it as follows:

 DirectoryIndex index.php index.html

Now, navigate to C:\PHP, and copy php.ini-development to php.ini. Edit this file:

extension_dir = "C:phpext"
memory_limit = 256M
post_max_size = 128M
upload_max_filesize = 128M

Enable extensions. This will depend on the libraries you want to use, but the following extensions should be suitable for the majority of applications (remove the semi-colon comment):


Restart Appache from cmd (command Prompt).

httpd -k restart

Step 5: Test your install
Navigate to C:\Apache24\htdocs and create a file called ‘test.php’ with following code:

<?php phpinfo();

In your browser, navigate to http://localhost/test.php. You should see a screen with masses of information and the PHP logo at the top. Check a few lines down for ‘Loaded Configuration File’ and make sure it says c:\php\php.ini.