PHP Installing a PHP environment on Windows Install PHP and use it with IIS

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!


First of all you need to have IIS (Internet Information Services) installed and running on your machine; IIS isn't available by default, you have to add the characteristic from Control Panel -> Programs -> Windows Characteristics.

  1. Download the PHP version you like from and make sure you download the Non-Thread Safe (NTS) versions of PHP.
  2. Extract the files into C:\PHP\.
  3. Open the Internet Information Services Administrator IIS.
  4. Select the root item in the left panel.
  5. Double click on Handler Mappings.
  6. On the right side panel click on Add Module Mapping.
  7. Setup the values like this:
Request Path: *.php   
Module: FastCgiModule  
Executable: C:\PHP\php-cgi.exe  
Name: PHP_FastCGI  
Request Restrictions: Folder or File, All Verbs, Access: Script
  1. Install vcredist_x64.exe or vcredist_x86.exe (Visual C++ 2012 Redistributable) from

  2. Setup your C:\PHP\php.ini, especially set the extension_dir ="C:\PHP\ext".

  3. Reset IIS: In a DOS command console type IISRESET.

Optionally you can install the PHP Manager for IIS which is of great help to setup the ini file and track the log of errors (doesn't work on Windows 10).

Remember to set index.php as one of the default documents for IIS.

If you followed the installation guide now you are ready to test PHP.

Just like Linux, IIS has a directory structure on the server, the root of this tree is C:\inetpub\wwwroot\, here is the point of entry for all your public files and PHP scripts.

Now use your favorite editor, or just Windows Notepad, and type the following:

header('Content-Type: text/html; charset=UTF-8');    
echo '<html><head><title>Hello World</title></head><body>Hello world!</body></html>';

Save the file under C:\inetpub\wwwroot\index.php using the UTF-8 format (without BOM).

Then open your brand new website using your browser on this address: http://localhost/index.php

Got any PHP Question?