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 the differences in configuration and performance of the three methods. 1. CGI (Common Gateway Interface/CommonGatewayInterface) is generally executable programs, such as EXE files, and WEB servers ">
In Windows IIS 6.0, PHP is usually configured in CGI, ISAPI, and FastCGI. these three modes can be successfully run in IIS 6.0, the following describes the differences in configuration and performance of the three methods.
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: \ 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.