1. cgi (Common Gateway Interface/Common Gateway Interface) is generally executable Program For example, the EXE file and the Web server occupy different processes. Generally, a CGI program can only process one user request. In this way, when the number of user requests is very large, it will occupy a lot of system resources, such as memory, CPU time, etc., resulting in low efficiency.
2. ISAPI (Internet server application program interface) is a set of web service-oriented API interfaces provided by Microsoft. It can implement all the functions provided by CGI and is expanded on this basis, for example, the filter application interface is provided. Most ISAPI applications are used as DLL dynamic libraries and can be executed after being requested by users. They will not disappear immediately after processing a user request, instead, it continues to reside in the memory and waits for other user input to be processed. In addition, the isapi dll application is in the same process as the Web server, and the efficiency is significantly higher than that of CGI.
In IIS6 of Windows Server 2003, configure the ISAPI-based PHP by adding a new Web Service extension in IIS's "Web Service extension". The program suffix is Php, the ISAPI program is php5isapi. DLL, and then add the variable name phprc to "environment variable"-"system variable". The value is Php. INI path. In Internet Information Service Manager, select the root directory of the website or application, open the directory properties page (right-click and select "properties"), and then select "main directory ". Click the "configuration" button and select the "ing" tab. Click "add... in the "executable file", set it to c: \ PHP \ php5isapi. DLL, with the extension set. PHP, select "check whether the file exists", and then "OK" to save the settings. Restart the server to complete the PHP configuration.
3. FastCGI is an open CGI extension of the Scalable Architecture. Its main behavior is to keep the CGI interpreter process in the memory and thus achieve high performance. The repeated loading of the traditional CGI interpreter is the main cause of low CGI performance. If the CGI interpreter is kept in the memory and is scheduled by the FastCGI Process Manager, it can provide good performance and scalability.
FastCGI has been integrated into iis7 and also supports IIS6. For the installation method in IIS6, refer to Microsoft's official documentation. Here is a simple translation.
Click here to download a 32-bit FastCGI extension for IIS, and then install it. The installed file should be in the System32 \ inetsrv directory.
Then open the System32 \ inetsrv directory and execute the following statement. c: \ PHP is your PHP Directory, which can be changed to another value.
Cscript fcgiconfig. js-add-Section: "php"-Extension: PHP-path: "C: \ PHP \ php-cgi.exe"
In Internet Information Service Manager, select the root directory of the website or application, open the directory properties page (right-click and select "properties"), and then select "main directory ". Click the "configuration" button and select the "ing" tab. Click "add... in the executable file, set it to c: \ windows \ system32 \ inetsrv \ fcgiext. DLL, with the extension set. PHP, select "check whether the file exists", and then "OK" to save the settings.
Modify the php. ini file and 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, configure the security of the c: \ PHP Directory so that the iis_wpg group has the permission to read and execute the directory.
At this time, FastCGI-based PHP is successfully configured on IIS6.
However, according to my own tests, FastCGI's performance is not much higher than that of ISAPI. I don't know if iis7 under Windows Server 2008 is better. Here is Microsoft's built-in FastCGI-based iis7 PHP installation method.
The biggest drawback of ISAPI is instability, which may cause the entire web server to crash due to program faults.
In a foreign evaluation, in Windows IIS 6, FastCGI performance is not as good as ISAPI, but it is superior in IIS 7.