IIS Support For PHP

Install Latest PHP Version (8.2)

This version of PHP requires C++ Redistributable for VS 2019 (at least)

Testing PHP Installation

Check installation by opening command prompt and change directory to “c:/php”

Microsoft Windows [Version 10.0.17763.3770]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\azureuser>cd C:\php
C:\php>php.exe --version
PHP 8.2.1 (cli) (built: Jan 3 2023 23:36:33) (NTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.2.1, Copyright (c) Zend Technologies

IIS Configuration

CGI Configuration

We need CGI module.


Install-WindowsFeature -name Web-WebServer, Web-CGI -IncludeManagementTools
  1. In the Action panel, click Add Module Mapping.
  2. In Request path, type “*.php”.
  3. From the Module menu, select FastCgiModule.
  4. In the Executable box, type the full path to Php-cgi.exe, for example C:\PHP\Php-cgi.exe.
  5. In Name, type a name for the module mapping, for example FastCGI.
    Click OK.

Default Document Configuration

Add “index.php” and “default.php” into “Default Document” module. So, if anyone visits
“localhost/wordpress”, if there is a file called with one of those names, it will be automatically served.

  1. In the Action panel, click Add. Type Index.php in the Name box, and then click OK.
  2. Click Add again. Type Default.php in the Name box, and then click OK.

PHP Manager Extension

PHP Manager extension help us to configure IIS for PHP.

WinCache extension [Optional]

The Windows Cache Extension for PHP is a PHP accelerator that is used to significantly increase the speed of PHP applications running on the Windows® operating system.

Environmental Variables [Optional]

Open the environmental Variables

Testing PHP Inside IIS

1. Open a text editor, for example Notepad, as Administrator.


<?php phpinfo(); ?>

Resources

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store