Example sharing of IIS server deployment php project

小云云
Release: 2023-03-22 21:50:02
Original
3344 people have browsed it

This article mainly shares with you examples of IIS server deployment PHP projects, mainly in the form of text and code, hoping to help everyone.

Host: Tencent Cloud Server, 2-core CPU, 4G memory version
Operating system: Windows Server 2012
Server: IIS 8
php version: 5.6
Uses the ThinkPHP framework.

IIS was originally installed on the server and a set of asp.NET websites were deployed. Later, the WeChat service was added and developed using php+MySQL. In order to facilitate management, we considered deploying the WeChat service on IIS.

Download version 5.6 from the PHP official website (VC11 needs to be installed to run PHP), modify the PHP configuration file, set the correct extension_dir, enable short tag support (short_open_tag), and enable fastCGI support (fastcgi.impersonate=1, cgi. forceredirect=0, cgi.fix_pathinfo=1), the plug-in enables php_gd2, php_mbstring, php_mysql, php_mysqli, php_pdo_mysql, and the time zone is changed to Asia/Shanghai.

Find the configuration file of the ThinkPHP framework and set the URL mode to 2 (Rewrite mode).

Download the two plug-ins corresponding to the IIS version: PHP Manager and URL Rewrite, add the PHP project folder to IIS, open PHP Manager, set the php version (PHP Setup - Register PHP version), and select the PHP file php-cgi.exe in the folder.

Enable the CGI and ISAPI functions of the IIS server (Control Panel-Add Windows Features).

After the web page is deployed, a web configuration file will be automatically created in the project folder, and Rewrite rules will be added to the system.webServer node of the configuration file.

Rule reference:

<rewrite>
     <rules>
      <rule name="cnUrl" stopProcessing="true">
       <match url="!^(index\.php|images|assets|robots\.txt)" />
       <action type="Rewrite" url="cnurl.php" />
      </rule>
      <rule name="Default" patternSyntax="Wildcard">
       <match url="*" />
        <conditions>
         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        </conditions>
       <action type="Rewrite" url="index.php" />
      </rule>
     </rules></rewrite>
Copy after login

URL Rewrite download address:
http://www.iis.net/downloads/microsoft/url-rewrite#additionalDownloads
PHP Manager download address : http://phpmanager.codeplex.com/

Related recommendations:

Apache deployment php project example sharing

About deploying PHP projects under Linux

Installing PHP development environment and deploying PHP projects

The above is the detailed content of Example sharing of IIS server deployment php project. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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!