IIS6 PHP's ISAPI and fastcgi performance comparison expectations Ii7_win server

Source: Internet
Author: User
Tags web services
1, the CGI (Universal Gateway Interface/common Gateway Interface) is generally executable programs, such as EXE files, and the Web server each occupy a different process, and generally a CGI program can only handle a user request. In this way, when the user requests a very long time, it will occupy the system resources, such as memory, CPU times, resulting in low performance.

2. The ISAPI (Internet Server application program Interface) is a set of Web services-oriented API interfaces provided by Microsoft, which enables all of the functionality provided by CGI and expands on this basis, For example, a filter application interface is provided. Most ISAPI applications are used as DLL dynamic libraries, which can be executed after being requested by the user, not disappearing immediately after processing a user request, but continuing to reside in memory waiting for other user input to be processed. In addition, the ISAPI DLL application and Web server are in the same process, with a significantly higher efficiency than CGI.

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

3, FASTCGI is a scalable architecture of the CGI open extension, the 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 low performance of CGI, if the CGI interpreter stays in memory and accepts the FASTCGI process Manager dispatch, it can provide good performance, scalability, etc.

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

Click here to download a 32-bit fastcgi extension for IIS, and then install it, after the installation of the file should be placed in the System32\inetsrv directory.

After opening the System32\inetsrv directory, execute the following statement, where c:\php for your PHP directory 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 of the Web site or application, open the Directory Properties page (right-click Select Properties), and select Home directory. Click the "Configure" button and select "Map" tab. Click "Add ..." in "Executable" set to: C:\windows\system32\inetsrv\fcgiext.dll, with the extension set to. php, select "Confirm File exists" and "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

Then open the System32\inetsrv directory and 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, the security of the c:\php directory is configured so that the IIS_WPG group has read and execute permissions for this directory.

At this point, PHP based on FastCGI was successfully configured to IIS6.

But according to my own tests, FastCGI's performance is not much higher than ISAPI's, and I don't know if IIS7 is better under Windows Server 2008. here is the Microsoft provides the method based on the built-in fastcgi IIS7 installs the PHP.

The biggest drawback of ISAPI is that it is unstable, and program failures can easily cause the entire Web server to crash.
A foreign evaluation, under Windows IIS 6, fastcgi performance is not as good as ISAPI, but under IIS 7.

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.