IIS is a powerful web server that can be used to deploy PHP websites. Although IIS is a Windows server, it supports PHP very well. This article will show you how to deploy a PHP website on IIS. The steps are as follows:
Step 1: Install IIS
On Windows servers, IIS comes as a component Installed. You can install IIS by following these steps:
1.1 Open "Server Manager".
1.2 Click "Roles" on the left menu bar.
1.3 Click "Add Roles" at the top of the right window.
1.4 In the "Add Roles Wizard" (Add Roles Wizard), select "Web Server (IIS)" (Web Server (IIS)) and install it.
Step 2: Install PHP
Now, you need to install PHP. You can download the latest version of PHP and install it according to the following steps:
2.1 Unzip the PHP installation package and place it in a certain directory.
2.2 Open the Control Panel, select "System and Security", then select "System".
2.3 Click "Advanced system settings" on the left menu bar.
2.4 In the "System Properties" dialog box, select "Environment Variables".
2.5 Under "System variables", find the "Path" variable and edit it.
2.6 Add the PHP installation path to the value of the variable, such as "C:\php" (Note: If you unzipped the PHP installation package to another location, you need to change it accordingly).
2.7 Click "OK" and close the environment variables dialog box.
Step 3: Configure IIS
Now you need to configure IIS to run PHP. You can follow the steps below to configure:
3.1 Open IIS Manager.
3.2 In the navigation panel on the left, click Server Node so that you can operate the entire server.
3.3 Double-click "Handler Mappings".
3.4 Click "Add Module Mapping".
3.5 Enter the following information:
Module: FastCGIModule
Executable file: C:\php\php-cgi .exe (please change to the actual path to PHP)
Name: PHP
3.6 Click OK and close the handler mapping dialog frame.
Step 4: Create a Website
Now, you need to create a website to host your PHP website. You can create a website by following the steps below:
4.1 Open IIS Manager.
4.2 In the navigation panel on the left, click "Sites".
4.3 Click "Add Website".
4.4 Enter the following information:
Website name: your website name
Physical path: your website folder Path
Hostname: The domain name bound to your website
Port: You can change the port number if needed
IP Address: If needed, you can specify the IP address of the website
4.5 Click "OK" and close the Add Website dialog box.
Step 5: Test your PHP website
Now you are ready to run your PHP website on IIS. You can follow these steps to test your PHP website:
5.1 Create a file in your website folder and name it "index.php".
5.2 Open a web browser and enter the address of your website in the address bar, such as "http://localhost/" or "http://www.yourdomain.com/".
5.3 If everything goes well, you will see the "index.php" page you created.
Summary
In this article, we introduced how to deploy a PHP website on IIS. To achieve this, you need to install IIS, PHP, and configure the FastCGI module in IIS. Once you complete these steps, you are ready to create a website and test your PHP website!
The above is the detailed content of How to deploy php website on iis? Step sharing. For more information, please follow other related articles on the PHP Chinese website!