Install and Configure PHP
Last updated: 2019-09-25 11:28:41PDF
To configure PHP in Windows CVMs, you need to add and install IIS role. For more information, please see Installing and Configuring IIS.
Installation of PHP Versions above 5.3
For PHP versions above 5.3, the installer mode has been canceled, and the installation is only performed through zip file or debug pack. The following example shows the zip installation in Windows Server 2012 R2 environment.
Download the PHP zip installer from the CVM (download URL: http://windows.php.net/download/).
You must select Non Thread Safe (NTS) x86 package when running under IIS. If you have to select x64 package for PHP in Windows Server 32bit (x64), you cannot select IIS. In this case, you can use Apache as an alternative option.
Select the installer as shown below:
The installation of PHP versions above 5.3 is dependent on Visual C++ Redistributable Update. Download and install VC Update Installer according to the name of downloaded PHP installer by referring to the relations as shown in the following table:
|PHP Installer Name||Download Link for Visual C++ Redistributable Installer|
|php-x.x.x-nts-Win32-VC14-x86.zip||Visual C++ Redistributable for Visual Studio 2015|
|php-x.x.x-nts-Win32-VC11-x86.zip||Visual C++ Redistributable for Visual Studio 2012 Update 4|
|php-x.x.x-nts-Win32-VC9-x86.zip||Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)|
If the downloaded PHP installer is as shown below:
then download the installer for VS 2015 version based on the relation indicated in the first row, and download and install the following two
Installation and configuration
Unzip the PHP zip installer (in this case, extract to
php.ini-productionand rename it to
php.ini, as shown below:
Click Server Manager -> IIS; On the local IIS, right-click and select IIS Manager:
Click on the host name (IP) on the left to go to the home page, and then double-click Handler Mappings:
Click Add Module Mappings on the right, enter the following information in the pop-up box, and click OK to save:
If you are unable to select
php-cgi.exeas the executable file, please change the filename extension of the selected file to .exe:
Click the server IP on the left to go to the home page and double-click Default Documents:
Click Add on the right to add a default document named
Click the server IP on the left to go to the home page and double-click FastCGI Settings:
Click Edit on the right, and select
php.inipath in Monitor the Changes Made to File:
Create a PHP file
C:\inetpub\wwwrootand write the following:
http://localhost/index.phpin the browser on CVM and check whether the environment has been configured successfully. The appearance of the following page indicates that the configuration has been completed successfully:
Installation of PHP 5.3 and earlier versions
PHP 5.3 and earlier versions are no longer available on the official download address http://windows.php.net/download/. To use these versions, download them locally and upload them to the CVM or search on the CVM network. For more information on uploading files, please see here.
Open PHP installer in the CVM.
Select IIS FastCGI in Web Server Setup, as shown below:
Complete the installation of PHP under the guidance of installation interface.
Create a PHP file
C:/inetpub/wwwroot, as shown below:
The following content is written to the
echo "<title>Test Page</title>"; echo "hello world";
Access the public network IP of Windows CVM via browser to check whether the environment configuration has been completed successfully. The appearance of the following page indicates that the configuration has been completed successfully: