Configure the ISAPI of PHP in IIS to compare with FastCGI. Configure PHP in WindowsIIS6.0. there are usually three configuration methods: CGI, ISAPI, and FastCGI. these three modes can be successfully run in IIS6.0, the following describes how to configure PHP in the three configuration methods in Windows IIS 6.0. there are usually three configuration methods: CGI, ISAPI, and FastCGI, all three modes can be successfully run in IIS 6.0. next I will talk about the differences in configuration and performance of these three modes.
1. CGI (Common Gateway Interface/Common Gateway Interface) is generally an executable program, such as an EXE file, and each WEB server occupies a different process, 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: phpphp5isapi. 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 placed in the system32inetsrv directory.
Then open the system32inetsrv directory and execute the following statement. c: php is your PHP Directory. you can change it to another value.
- cscript fcgiconfig.js -add -section:"PHP" -extension:php -path:"c:phpphp-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: windowssystem32inetsrvfcgiext. 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 system32inetsrv 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.
When configuring PHP in IIS 6.0, there are usually three configuration methods: CGI, ISAPI, and FastCGI. these three modes can be successfully run in IIS 6.0, next, let's talk about the zones configured in these three methods...