How To Install PHP On Windows 10

 

Every three or four years I need to install PHP on a new Windows laptop. And each time I go through a battle - it's so confusing to find simple instructions on how to do it. Here are the steps I used in February 2018. It should take 5 minutes if all goes well. Fingers crossed...

Firstly you need to make sure you have IIS running. Here's my article on installing IIS

Download the correct version of PHP for your machine's hardware from the Windows PHP documentation. Note that it says: 

If you are using PHP as FastCGI with IIS you should use the Non-Thread Safe (NTS) versions of PHP.

That means you should be downloading this file

 

php download file

However this file came down at an agonisingly slow speed so instead, I downloaded PHP from http://php.net/manual/en/install.windows.manual.php

Unzip this file. I unzipped it at c:\Program Files (x86)\php. Take a copy of the file php.ini-production and rename it to php.ini

Open IIS and at the root node click on Handler Mappings

IIS Handler Mappings

 

Then select Add Module Mapping

IIS module mapping

Note the details of the module

Edit module mapping

This has wired PHP into IIS. To test it, create a PHP file and execute it as per the test script I set up on the IIS install page.

<?php

phpinfo();

?>

If the installation has been successful the php details should show if all is OK

phpinfo

That's it - I hope this works for you!

Share