Home >Backend Development >PHP Problem >Can a php website be deployed under iis?

Can a php website be deployed under iis?

藏色散人
藏色散人Original
2022-01-26 10:25:084383browse

The PHP website can be deployed under iis. The operation method is: 1. Start the iis server and open the IIS server; 2. Create the website; 3. Click "Handler Mapping" and click "Add Mapping Module" on the right "; 4. Add the default document and enter "index.php"; 5. Use URL rewriting.

Can a php website be deployed under iis?

The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer

Deploy PHP on IIS Website

Before deploying the website, check whether CGI has been installed on the system

1. Start the iis server and open the IIS server

Open the IIS server, click on the website, and right-click "Add website"

2. Create a website

After clicking "Add website", enter the page and fill in the website-related content, such as: website name, physical path (the folder where the website is located), click "OK" to create successfully

3. PHP settings

Click on the created website and click "Handler Mapping" , click "Add Mapping Module" on the right, enter the corresponding parameters in the pop-up layer, and click Confirm

Set default document

Click "Default Document", right-click the "Add" button, add a default document, enter index.php, click "OK" to add

4. Install urlrewrite

5. Use URL rewrite

Click "URL Rewrite" and click " "Import Rules", select the rule file to be imported, and click Apply

After applying the rules, a web.config file will be generated in the root directory of the website. This uses the rules for importing thinkphp's .htaccess file

File content:

<?xml version="1.0" encoding="UTF-8"?>
 <configuration>
     <system.webServer>
         <rewrite>
             <rules>
                 <rule name="已导入的规则 1" stopProcessing="true">
                     <match url="^(.*)$" ignoreCase="false" />
                     <conditions logicalGrouping="MatchAll">
                         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                         <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                     </conditions>
                     <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
                 </rule>
             </rules>
         </rewrite>
         <handlers>
             <add name="php-cgi" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="D:\phpStudy\php56n\php-cgi.exe" resourceType="File" />
         </handlers>
         <defaultDocument>
             <files>
                 <add value="index.php" />
             </files>
         </defaultDocument>
     </system.webServer>
 </configuration>

Recommended study: "PHP Video Tutorial"

The above is the detailed content of Can a php website be deployed under iis?. 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
Previous article:What does php oop mean?Next article:What does php oop mean?