How to deploy php on iis? Step sharing

PHPz
Release: 2023-04-03 16:54:01
Original
3934 people have browsed it

IIS is a very popular web server software that is widely used on Windows operating system platforms. The counterpart is PHP, a popular scripting language. This article will teach you how to deploy PHP on IIS from scratch.

1. Install IIS

Before deploying PHP, you first need to install IIS on the server. The specific steps are as follows:

1. Open "Server Manager" and select "Role"->"Add Role".
2. In the "Install Single Server Role" window, select "Web Server (IIS)" and click "Next".
3. In the "Web Server (IIS)" window, click "Next".
4. In the "Role Service" window, select the IIS components that need to be installed and click "Next". Here you need to select "Web Server" and "Web Management Tool", and other components can be selected as needed.
5. In the "Confirm Installation Selection" window, click "Install" to start installing IIS.

2. Install PHP

After installing IIS, you can start installing PHP. The specific steps are as follows:

1. Download the PHP installation package. You can download the latest stable version of PHP from the PHP official website (https://windows.php.net/download/).
2. Unzip the PHP installation package to a suitable directory. Here we take "C:\php" as an example.
3. Open "Server Manager", select "Role" -> "Web Server (IIS)" -> "Internet Information Services (IIS) Manager" to enter the IIS Manager.
4. Find the "Server" node in the left menu bar, right-click and select "Add Website".
5. In the "Add Website" window, enter the website name and specify the physical path of the website (that is, the directory where the PHP installation package was just decompressed), and click "Next".
6. In the "Add Binding" window, specify the domain name or IP address and port number supported by the website (the default is port 80), and click "OK" to complete adding the website.
7. Find the newly added website in IIS Manager, right-click and select "Properties".
8. Select the "Handler Mapping" tab and click "Add Module Mapping".
9. In the new "Add Mapping" window, enter the following information:
1) Request path: *.php
2) Module: FastCgiModule
3) Executable file: C: \php\php-cgi.exe (note that the installation directory and executable file name need to be modified according to the actual situation)
Then click "OK" to complete the mapping addition.

3. Test PHP

After completing the installation of PHP, you need to test whether it can run normally. The specific steps are as follows:

1. Create a PHP file, such as "test.php", enter the following content:
phpinfo();
?>
2. Place the "test.php" file in the root directory of the IIS website, which is the physical path just specified.
3. Enter the domain name or IP address of the website in the browser, plus the "test.php" file you just created, such as "http://127.0.0.1/test.php".
4. If the configuration information of PHP is displayed in the browser, it proves that PHP has been successfully deployed on IIS.

Summary:

Deployment of PHP on IIS requires the installation of two software, PHP and IIS. The process is basically divided into several steps such as installing IIS, installing PHP, configuring mapping, and testing PHP. If you have no experience deploying PHP on IIS, you can follow the above steps. I believe you can also successfully complete the deployment task.

The above is the detailed content of How to deploy php on iis? Step sharing. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!