Three ways to configure PHP under IIS comparison

Source: Internet
Author: User

In the configuration of PHP under Windows IIS 6.0, there are usually CGI, ISAPI and fastcgi three configuration methods, these three modes can be successfully run under IIS 6.0, I would like to talk about the three ways to configure the difference and performance differences.

1, CGI (Universal Gateway Interface/common Gateway Interface) is generally executable programs, such as EXE files, and Web servers each occupy a different process, and generally a CGI program can only handle one user request. In this way, when the user requests a very large amount of resources, such as memory, CPU time, and so on, resulting in low performance.

2. ISAPI (Internet Server application program Interface) is a set of Web service-oriented API interfaces provided by Microsoft, which can implement all the functions provided by CGI and extend it on this basis. As provided by the filter application interface. Most ISAPI applications are used in the form of DLL dynamic libraries, which can be executed after a user request, does not disappear immediately after processing a user request, but continues to reside in memory waiting for other user input to be processed. In addition, ISAPI DLL applications and Web servers are in the same process and are significantly more efficient than CGI.

Configure the ISAPI mode of PHP under IIS6 in Windows Server 2003 by adding a new Web service extension in the Web service Extensions for IIS, with the program suffix PHP,ISAPI program as Php5isapi.dll, and then " environment variable "-" System variable "add the variable name PHPRC, the value is the path of php.ini, in Internet Information Services Manager, select the root directory of the Web site or application, open the Directory property page (right-click on" Properties "), and select" Home Directory ". Click the "Configure" button and select the "Mappings" tab page. Click "Add ...", in the "executable" set to: C:\php\php5isapi.dll, the extension is set to. php, select "Confirm File exists", and then "OK" to save the settings. Restart the server to complete the configuration of PHP.

3. FastCGI is a CGI open extension of the scalable architecture, whose main behavior is to keep the CGI interpreter process in memory and thus achieve high performance. The traditional CGI interpreter's repeated loading is the main reason for the poor CGI performance, if the CGI interpreter remains in memory and accepts the FASTCGI process manager scheduling, it can provide good performance, scalability, and so on.

FASTCGI has been integrated in the IIS7, but also supports IIS6, the installation method in IIS6 can be found in the official Microsoft documentation, I have a simple translation here.

First click here to download a 32-bit fastcgi extension for IIS, and then install it, the installed files should be placed in the System32\inetsrv directory.

After opening the System32\inetsrv directory, execute the following statement, where c:\php is your PHP directory and can be modified to other values.

cscript fcgiconfig.js-add-section: "PHP"-extension:php-path: "C:\php\php-cgi.exe"

In Internet Information Services Manager, select the root directory for the Web site or application, open the Directory Properties page (right-click Properties), and then select Home directory. Click the "Configure" button and select the "Mappings" tab page. Click "Add ...", in the "executable" set to: C:\windows\system32\inetsrv\fcgiext.dll, the extension is set to. php, select "Confirm File exists", and then "OK" to save the settings.

Modify the php.ini file to add the following statement:

Fastcgi.impersonate = 1
Cgi.fix_pathinfo = 1
Cgi.force_redirect = 0

After opening the System32\inetsrv directory, execute the following statement:

cscript fcgiconfig.js-set-section: "PHP"-instancemaxrequests:10000
cscript fcgiconfig.js-set-section: "PHP"-environmentvars:php_fcgi_max_requests:10000

Finally, configure the security of the c:\php directory so that the IIS_WPG group has read and execute permissions for the directory.

At this time, fastcgi-based PHP was successfully configured on the IIS6.

Three ways to configure PHP under IIS comparison

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.