IIS下PHP的三种配置方式比较
在Windows IIS 6.0下配置PHP,通常有CGI、ISAPI和FastCGI三种配置方式,这三种模式都可以在IIS 6.0下成功运行,下面我就讲一下这三种方式配置的区别和性能上的差异。 1、CGI(通用网关接口/Common Gateway Interface)一般是可执行程序,例如EXE文件,和WEB
在Windows IIS 6.0下配置PHP,通常有CGI、ISAPI和FastCGI三种配置方式,这三种模式都可以在IIS 6.0下成功运行,下面我就讲一下这三种方式配置的区别和性能上的差异。
1、CGI(通用网关接口/Common Gateway Interface)一般是可执行程序,例如EXE文件,和WEB服务器各自占据着不同的进程,而且一般一个CGI程序只能处理一个用户请求。这样,当用户请求数量非常多时,会大量占用系统的资源,如内存、CPU时间等,造成效能低下。
2、ISAPI(Internet Server Application Program Interface)是微软提供的一套面向WEB服务的API接口,它能实现CGI提供的全部功能,并在此基础上进行了扩展,如提供了过滤器应用程序接口。ISAPI应用大多数以DLL动态库的形式使用,可以在被用户请求后执行,,在处理完一个用户请求后不会马上消失,而是继续驻留在内存中等待处理别的用户输入。此外,ISAPI的DLL应用程序和WEB服务器处于同一个进程中,效率要显著高于CGI。
在Windows Server 2003的IIS6下配置ISAPI方式的PHP,配置方法是,在IIS的“WEB服务扩展”中,添加一个新的WEB服务扩展,程序后缀为PHP,ISAPI程序为php5isapi.dll,然后再“环境变量”-“系统变量”中增加变量名PHPRC,数值为php.ini的路径,在Internet信息服务管理器中,选择网站或应用程序的根目录,打开目录属性页(右键选择“属性”),再选择“主目录”。点击“配置”按钮,选择“映射”Tab页。点击“添加...”,在“可执行文件”设为: c:\php\php5isapi.dll,扩展名设为.php,选择“确认文件是否存在”,然后“确定”保存设置。重启服务器即可完成PHP的配置。
3、FastCGI是可伸缩架构的CGI开放扩展,其主要行为是将CGI解释器进程保持在内存中并因此获得较高的性能。传统的CGI解释器的反复加载是CGI性能低下的主要原因,如果CGI解释器保持在内存中并接受FastCGI进程管理器调度,则可以提供良好的性能、伸缩性等。
FastCGI已经集成于IIS7,也支持IIS6,在IIS6中的安装方法可参见微软的官方文档,我这里简单翻译一下。
先点这里下载一个32位的FastCGI extension for IIS,然后将其安装,安装后的文件应该放到system32\inetsrv目录下。
之后打开system32\inetsrv目录,执行下面的语句,其中c:\php为你的PHP目录,可以修改为其他数值。
cscript fcgiconfig.js -add -div:"PHP" -extension:php -path:"c:\php\php-cgi.exe"
在Internet信息服务管理器中,选择网站或应用程序的根目录,打开目录属性页(右键选择“属性”),再选择“主目录”。点击“配置”按钮,选择“映射”Tab页。点击“添加...”,在“可执行文件”设为: c:\windows\system32\inetsrv\fcgiext.dll,扩展名设为.php,选择“确认文件是否存在”,然后“确定”保存设置。
修改php.ini文件,增加如下语句:
fastcgi.impersonate = 1
cgi.fix_pathinfo = 1
cgi.force_redirect = 0
之后打开system32\inetsrv目录,执行以下语句:
cscript fcgiconfig.js -set -div:"PHP" -InstanceMaxRequests:10000
cscript fcgiconfig.js -set -div:"PHP" -EnvironmentVars:PHP_FCGI_MAX_REQUESTS:10000
最后,配置c:\php目录的安全性,使得IIS_WPG组对于这个目录有读取和执行的权限。
这时候,基于FastCGI的PHP就成功配置到IIS6上了。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

In PHP8, match expressions are a new control structure that returns different results based on the value of the expression. 1) It is similar to a switch statement, but returns a value instead of an execution statement block. 2) The match expression is strictly compared (===), which improves security. 3) It avoids possible break omissions in switch statements and enhances the simplicity and readability of the code.

In PHP, you can effectively prevent CSRF attacks by using unpredictable tokens. Specific methods include: 1. Generate and embed CSRF tokens in the form; 2. Verify the validity of the token when processing the request.

Solving the problem of slow Photoshop startup requires a multi-pronged approach, including: upgrading hardware (memory, solid-state drive, CPU); uninstalling outdated or incompatible plug-ins; cleaning up system garbage and excessive background programs regularly; closing irrelevant programs with caution; avoiding opening a large number of files during startup.

How to implement Windows-like in front-end development...

In PHP, the final keyword is used to prevent classes from being inherited and methods being overwritten. 1) When marking the class as final, the class cannot be inherited. 2) When marking the method as final, the method cannot be rewritten by the subclass. Using final keywords ensures the stability and security of your code.

How to distinguish between closing tabs and closing entire browser using JavaScript on your browser? During the daily use of the browser, users may...

The... (splat) operator in PHP is used to unpack function parameters and arrays, improving code simplicity and efficiency. 1) Function parameter unpacking: Pass the array element as a parameter to the function. 2) Array unpacking: Unpack an array into another array or as a function parameter.
