Configure the PHP environment for IIS7 + FastCGI in Windows

Source: Internet
Author: User

PHP for windows has no longer supported ISAPI loading since PHP5.3. According to Microsoft's recommendation, FastCGI is the best and fastest way to load the php environment, fastCGI greatly enhances IIS's ability to process PHP, rapidly improves the response speed and productivity of PHP sites, and has higher stability and security.


There are three main ways to build a PHP environment on IIS:

1. cgi PHP environment. Generally, php.exe is used as the interpreter in iis. Features: stability, but low efficiency.

2. The ISAPI method is used to load the PHP environment. The configuration interpreter in IIS is php5isapi. dll, which is currently the most widely used and widely used. Features: multithreading, high efficiency, but not stable enough.

3. FastCGI loading PHP environment is not common in the IIS environment, but there are still some applications in other system environments, but IIS7.0 has started to build FastCGI. Features: High Efficiency and high stability are future development trends.

PHP for windows has no longer supported ISAPI loading since PHP5.3. According to Microsoft's recommendation, FastCGI is the best and fastest way to load the php environment, fastCGI greatly enhances IIS's ability to process PHP, rapidly improves the response speed and productivity of PHP sites, and has higher stability and security.

The following hands-on configuration of PHP environment, IIS + FastCGI using PHP, You need to download VC9 Non Thread Safe version, for the http://windows.php.net/download/ before installing PHP, first of all, we should install IIS FastCGI for IIS (IIS7 has been built in), for the http://www.iis.net/expand/fastcgi next is to install Php, the installation process only one step is worth noting, that is, the need to select IIS FastCGI:

After the installation is complete, open the command prompt and enter the following command

The Code is as follows: Copy code
Cd C:/WINDOWS/system32/inetsrv cscript fcgiconfig. js-add-section: "PHP"-extension: php-path: "C:/Program Files/PHP/php-cgi.exe" # Note: path: "xxxx/php-cgi.exe & rdquo; is the directory where you install php cscript fcgiconfig. js-set-section: "PHP"-InstanceMaxRequests: 10000 cscript fcgiconfig. js-set-section: "PHP"-EnvironmentVars: PHP_FCGI_MAX_REQUESTS: 10000

OK! Finished! Test: Create a. php file with the following content:

The Code is as follows: Copy code

<? Php

Phpinfo ();

?>

If the following interface is displayed, you can do it!

This method does not need to be configured in IIS. It will be automatically configured! If the php test page is run after the configuration is completed according to the above tutorial, Error 500 is displayed. Set the date. timezone item in php. ini. Set it to the Shanghai Time Zone: date. timezone = Asia/beijing. After the settings are complete, everything works!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.