This topic describes how to use Internet Information Services (IIS) to build a PHP environment on a Windows instance.
Procedure
In this example, Windows Server 2012 is used. Operations vary based on operating systems.
Connect to the Windows instance.
For more information, see Connection methods.
Install IIS.
For more information, see How to install IIS and FTP services on Windows instances.
Important.NET Framework 3.5 must be installed. Otherwise, PHP Manager cannot be installed.
Install the Web Platform Installer.
ImportantIf your operating system is Windows Server 2008, you can only download a Web Platform Installer installation file from the Web Platform Installer page and then double-click the file to install the Web Platform Installer.
In upper-right corner of the Server Manager window, choose Tools > Internet Information Services (IIS) Manager.
In the Internet Information Services (IIS) Manager dialog box, click Yes.
On the Web Platform Installer page, download the Web Platform Installer installation file. Then, install the Web Platform Installer.
After the Web Platform Installer is installed, you can find it in the Management section of the Internet Information Services (IIS) Manager window.
Install PHP Manager.
Method 1 (Recommended): Download a PHP Manager installation file from GitHub and then double-click the file to install PHP Manager.
Method 2: Use the Web Platform Installer to install PHP Manager.
Start the Web Platform Installer and search for PHP Manager on the Applications tab.
Find PHP Manager and click Add. Then, in the lower part of the Web Platform Installer window, click Install.
After PHP Manager is installed, you can find it in the IIS section of the Internet Information Services (IIS) Manager window.
Install PHP.
Start the Web Platform Installer and search for the PHP version that you want to install on the Applications tab.
In this example, PHP 7.2 is used. Perform the following operations to install PHP.
NoteYou can install multiple PHP versions based on your needs.
Click Add and then click Install in the lower part of the Web Platform Installer window.
If a page similar to the one in the following figure is displayed, it indicates that PHP is installed.
Click Finish.
Build a PHP environment.
In the IIS section of the Internet Information Services (IIS) Manager window, double-click PHP Manager.
Click Register new PHP version. In the dialog box that appears, select the php-cgi.exe file in the directory where the specified PHP version is installed and click OK to build a PHP environment.
(Optional) Click Change PHP version. In the Change PHP version dialog box, select a PHP version.
(Optional) Click Check phpinfo() and view the selected PHP version.
FAQ
A 500
error is reported when I use IIS to debug PHP. What do I do?
If you are prompted with a 500
error when you use IIS to debug PHP, set Identity in the Application Pool Defaults dialog box to LocalSystem
. In this example, Windows Server 2012 is used. Perform the following steps:
In the left-side navigation pane of the Internet Information Services (IIS) Manager window, click Application Pools.
Right-click a blank area in the application pool list and select Set Application Pool Defaults.
In the Process Model section of the Application Pool Defaults dialog box, set Identity to
LocalSystem
.Click OK.