Current Location: Home> Latest Articles> Detailed Guide to Configure PHP Environment on Alibaba Cloud Windows Server

Detailed Guide to Configure PHP Environment on Alibaba Cloud Windows Server

M66 2025-08-07

How to Configure Alibaba Cloud Windows Server to Support PHP?

With the continuous growth of web applications, PHP, as a mainstream server-side scripting language, is widely used in website and application development. Many developers and system administrators may encounter configuration challenges when setting up a PHP environment on Alibaba Cloud Windows servers. This article will guide you step-by-step on installing and configuring PHP on Alibaba Cloud Windows server to ensure PHP runs smoothly.

Download and Install PHP

First, log in to the Alibaba Cloud Windows server via Remote Desktop, open a browser and visit the official PHP download page to select and download the Windows-compatible PHP version. During installation, you can choose the default path or customize the installation directory as needed.

Configure IIS to Support PHP

Next, you need to install and configure IIS (Internet Information Services) on the Windows server:

  • Open "Server Manager" and add the "Web Server (IIS)" role.
  • After installation, open "IIS Manager", select the server name, and go to "Handler Mappings".
  • Click "Add Module Mapping" and fill in the following information:
  • Request path: *.php
  • Module: FastCgiModule
  • Executable: specify the path to the PHP CGI executable, e.g., C:\PHP\php-cgi.exe (adjust according to your actual installation path)
  • Name: a custom name such as "PHP"

Make sure the FastCGI module is enabled. If not installed, you can enable the "CGI" feature in the server roles and features.

Adjust php.ini Configuration

Open the php.ini file in the PHP installation directory and make the following adjustments:

  • Set extension directory: extension_dir = "ext"
  • Disable force redirect: cgi.force_redirect = 0
  • Enable path info fix: cgi.fix_pathinfo = 1
  • Enable FastCGI impersonation: fastcgi.impersonate = 1
  • Disable FastCGI logging: fastcgi.logging = 0

Also, ensure to enable commonly used PHP extensions:

extension=php_mbstring.dll
extension=php_exif.dll
extension=php_mysqli.dll
extension=php_openssl.dll

Restart IIS Service and Verify PHP Operation

After finishing the configuration above, go back to IIS Manager, right-click the server name, select "Manage" then "Restart" to apply the changes.

To verify PHP is working, create a test.php file with the following content:

<?php
phpinfo();
?>

Place this file in the web root directory, then visit http://your-server-ip/test.php in a browser. If the PHP info page displays, your PHP environment is properly set up and running.

Summary

Following these steps, you can successfully install and configure PHP on an Alibaba Cloud Windows server to support web application development and deployment. Proper configuration enhances performance and provides a reliable foundation for future development.