How to set up IIS on Windows 10 to allow php extensions from your localhost website.
This segment will show you how to set the localhost website (IIS) to run php extended files and to be accessible from other PC's that are connected to the local network.
To allow PHP extension pages please consider the following steps:
1. Ensure the following IIS elements are installed on your PC:
Go to Control Panel -> Programs ->Programs and Features->on left hand side Turn Windows features on or off->scroll down to Internet Information Services ->check that the following boxes are ticked as shown on figure 1.
To check that IIS is up and running for the first time enter localhost in your browser then hit Return. The following page should appear, figure 2:

2. Install PHP:
a. Download and run the Microsoft Web Platform Installer which is available at https://www.microsoft.com/WEB/downloads/platform.aspx
b. Search for PHP then Add the following programs (figure 3):
PHP 7.1.7 (x64)
Windows Cache Extension 2.0 (x64) for PHP 7.1
IISNode for IIS (IIS exists)

c. Hit Install - after installation Web Platform Installer should have the programs marked as Installed - refer figure 3.
d. You should now have PHP 7.1 installed somewhere on your root directory - mine was at C:\Program Files\PHP\V7.1
e. Go to the C:\Program Files\PHP\V7.1 directory then open php.ini in say, notepad++ and make the following changes (remove leading semi-colons):
(Note that initally there are two files, php.ini-development and php.ini-production. Rename one of these to php.ini)
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
extension=php_curl.dll
extension=php_gd2.dll
extension=php_mysqli.dll
extension=php_openssl.dll
extension=php_xmlrpc.dll
extension=php_wincache.dll
3. Save the php directory to Path in System Variables, figure 4. System variables can be found at: control panel->System and Security->Advanced system settings->Environment Variables->System variableshighlight Path then click on New... to add the php directory path or Edit... to make a change to the entry.

4. Add FastCGI to Handler Mappings:
Location of the module is at C:\Program Files\PHP\v7.1\php-cgi.exe.
Go to Control Panel->Administrative Tools->Internet Information Services (IIS) Manager->expand Connections on left hand side->expand Sites->click on Default Web Site->double click Handler Mappings (figure 5).

On right hand side select and click on Add Managed Handler or Edit... to change (figure 6)->enter the information as shown on figure 6 -> click OK
FastCGI module should now be seen in the Handler Mappings window.

5. Now create a file called test.php and include the following:
6. Run this file from your browser - enter localhost/test.php - it should produce the following, figure 7:

So there you have it. Is a rather long winded procedure but hopefully gets your website up and running with php.
To allow PHP extension pages please consider the following steps:
1. Ensure the following IIS elements are installed on your PC:
Go to Control Panel -> Programs ->Programs and Features->on left hand side Turn Windows features on or off->scroll down to Internet Information Services ->check that the following boxes are ticked as shown on figure 1.

figure 1

figure 2
2. Install PHP:
a. Download and run the Microsoft Web Platform Installer which is available at https://www.microsoft.com/WEB/downloads/platform.aspx
b. Search for PHP then Add the following programs (figure 3):
PHP 7.1.7 (x64)
Windows Cache Extension 2.0 (x64) for PHP 7.1
IISNode for IIS (IIS exists)

figure 3
c. Hit Install - after installation Web Platform Installer should have the programs marked as Installed - refer figure 3.
d. You should now have PHP 7.1 installed somewhere on your root directory - mine was at C:\Program Files\PHP\V7.1
e. Go to the C:\Program Files\PHP\V7.1 directory then open php.ini in say, notepad++ and make the following changes (remove leading semi-colons):
(Note that initally there are two files, php.ini-development and php.ini-production. Rename one of these to php.ini)
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
extension=php_curl.dll
extension=php_gd2.dll
extension=php_mysqli.dll
extension=php_openssl.dll
extension=php_xmlrpc.dll
extension=php_wincache.dll
3. Save the php directory to Path in System Variables, figure 4. System variables can be found at: control panel->System and Security->Advanced system settings->Environment Variables->System variableshighlight Path then click on New... to add the php directory path or Edit... to make a change to the entry.

figure 4
4. Add FastCGI to Handler Mappings:
Location of the module is at C:\Program Files\PHP\v7.1\php-cgi.exe.
Go to Control Panel->Administrative Tools->Internet Information Services (IIS) Manager->expand Connections on left hand side->expand Sites->click on Default Web Site->double click Handler Mappings (figure 5).

figure 5
On right hand side select and click on Add Managed Handler or Edit... to change (figure 6)->enter the information as shown on figure 6 -> click OK
FastCGI module should now be seen in the Handler Mappings window.

figure 6
5. Now create a file called test.php and include the following:
<html>
<head>
<title>php test</title>
</head>
<body>
<div style='margin:100px;font:30px Calibri;color:brown'>
This page is a test to see if PHP extension is working?
</div>
<?php phpinfo(); ?>
</body>
</html>
<head>
<title>php test</title>
</head>
<body>
<div style='margin:100px;font:30px Calibri;color:brown'>
This page is a test to see if PHP extension is working?
</div>
<?php phpinfo(); ?>
</body>
</html>
Save test.php to the wwwroot directory which is at C:\inetpub\wwwroot\
6. Run this file from your browser - enter localhost/test.php - it should produce the following, figure 7:

figure 7
So there you have it. Is a rather long winded procedure but hopefully gets your website up and running with php.
Comments
Display comments as Linear | Threaded