Home >Backend Development >PHP Tutorial >How to configure Alibaba Cloud Win server to support PHP running?

How to configure Alibaba Cloud Win server to support PHP running?

WBOY
WBOYOriginal
2024-03-06 11:06:031004browse

How to configure Alibaba Cloud Win server to support PHP running?

How to configure the Alibaba Cloud Win server to support PHP running?

With the rise of web applications, PHP is widely used as a popular server-side scripting language. Setting up and running a PHP environment on Alibaba Cloud's Windows server is one of the challenges faced by many developers and administrators. This article will introduce in detail how to configure the PHP environment on Alibaba Cloud's Windows server so that it can run smoothly.

First, make sure you have purchased a Windows server on Alibaba Cloud and have connected to the server's remote desktop. Next, follow the steps below to configure:

Step 1: Download and install PHP

  1. Open https://windows.php.net/download/ in your browser, Choose the PHP version for Windows and download it.
  2. Run the downloaded PHP installer and follow the prompts to install. You can choose the default installation path or customize the installation path.

Step 2: Configure IIS

  1. Open "Server Manager" on the Windows server and select "Role"->"Web Server (IIS)" -> "Internet Information Services (IIS) Manager" to install.
  2. In IIS Manager, select the server name, double-click "Handler Mapping", click "Add Module Mapping", and then fill in the following information:

    • Request path: *.php
    • Module: FastCgiModule
    • Executable file: C:PHPphp-cgi.exe (fill in according to the actual installation path)
    • Name: PHP
  3. Make sure that the FastCGI module has been installed. If it is not installed, go to "Role"->"Web Server (IIS)"->"Internet Information Services (IIS) Manager"->"Web Server Check "CGI" in "Role (IIS)"->"Web Server"->"Application Server"->"Web Server"->"Application Server"->"Role Service".

Step 3: Configure PHP

  1. Open the php.ini file in the PHP installation directory and configure the following parameters:

    • extension_dir = "ext"
    • cgi.force_redirect = 0
    • cgi.fix_pathinfo = 1
    • fastcgi.impersonate = 1
    • fastcgi.logging = 0
  2. Add the following extension in the php.ini file:
    extension=php_mbstring.dll
    extension=php_exif.dll
    extension=php_mysqli.dll
    extension =php_openssl.dll

Step 4: Restart the IIS service

  1. Select the server name in the IIS manager, right-click "Manage" and select "Start") Restart IIS service.
  2. Confirm whether PHP has been successfully installed and configured correctly. Visit http://serverIP/test.php in the browser, create a test.php file with the content:
<?php
phpinfo();
?>

Save the file, and enter the server IP/test in the browser .php. If the PHP information page can be displayed normally, the configuration is successful.

Through the above steps, you can successfully configure the PHP environment on Alibaba Cloud's Windows server and make it run smoothly. I hope this article will be helpful to you, and I wish you success in setting up a PHP environment and achieving more web application development and deployment.

The above is the detailed content of How to configure Alibaba Cloud Win server to support PHP running?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn