如何确定 FastCGI 是否用于运行 php 脚本
我有一个托管站点,但在配置 Joomla 时遇到问题(在 IIS7 + win server 2008 上运行 Joomla + php + mySQL).我在本地机器上运行了类似的配置(IIS7 + vista x64 上的 Joomla + php + mySQL),所以我至少能够按照各种教程中关于如何设置它的说明进行操作.
I have a hosted site and I'm having trouble configuring Joomla (running Joomla + php + mySQL on IIS7 + win server 2008). I have a similar configuration running on a local machine (Joomla + php + mySQL on IIS7 + vista x64), so I was at least able to follow instructions showed in various tutorials on how to set this up.
托管站点的这种症状是我无法在 Joomla 中打开任何 SEO 设置(甚至不是第一个设置,搜索引擎友好 URL").我得到 404(未找到文件)或 URL 显示正确重写,但始终显示主页的内容.我在我的家用机器上遇到了类似的问题,原来是因为我没有使用 FastCGI 来托管 php,所以我决定在托管站点上进行调查.
This symptom with the hosted site is that I can't turn on any SEO settings in Joomla (not even the first setting, "Search Engine Friendly URLs"). I get either 404 (file not found) or the URL appears correctly rewritten but it's always the home page's content that is displayed. I had a similar issue on my home machine and it turns out to have been because I wasn't using FastCGI to host php, so I decided to investigate that on the hosted site.
无论如何,我在托管站点上托管 joomla 的目录的 web.config 文件中注意到以下行:
Anyway, I noticed in the web.config file of the directory hosting joomla on the hosted site the following line:
<add name="Plesk_Handler_3522909676" path="*.php" verb="*" modules="IsapiModule" scriptProcessor="c:program files (x86)parallelspleskadditionalpleskphp5php5isapi.dll" resourceType="Either" />
根据以往的经验,我知道 php 在 fastCGI 下不运行时会出现一些问题.我注意到根文件夹中的 web.config 使用了以下行:
From past experience, I know that php has some issues when not running under fastCGI. I noticed the web.config in the root folder used the following line instead:
<add name="Plesk_Handler_0286090609" path="*.php" verb="*" modules="CgiModule" scriptProcessor="c:program files (x86)parallelspleskadditionalpleskphp5php-cgi.exe" resourceType="Either" />
我在 joomla 目录的 web.config 中复制了它,并得到了不同的行为......但仍然无法正常工作.如果我在运行 phpInfo() 的 joomla 目录中加载 .php 文件,则在 Server API 下它会显示 CGI/FastCGI .是否肯定确认正在使用 FastCGI?为什么 web 配置中的处理程序指向 modules="CgiModule" 而不是 modules="FastCgiModule" (我什至不确定是否存在,但我只是发现提到 CgiModule 很可疑).
I copied that in the web.config in the joomla directory, and got different behavior... but still not working. If I load a .php file in the joomla directory that runs phpInfo(), under Server API it says CGI/FastCGI . Is that positive confirmation that FastCGI is being used? Why does the handler in the web config point to modules="CgiModule" instead of modules="FastCgiModule" (I'm not even sure that exists, but I just find the mention of CgiModule suspicious).
这是一个托管站点,据我所知,我无权访问 ApplicationHost.config 文件...
It's a hosted site, so as far as I know I don't have access to ApplicationHost.config file...
推荐答案
这是一个简单的测试:
- 用 创建一个 phpinfo.php 文件
- Create a phpinfo.php file with
<?php phpinfo(); ?>
里面;
请求 http://yoursite.com/phpinfo.php/foobar?foo=bar
检查 phpinfo 的输出并查找 _SERVER["REQUEST_URI"].
Check the output of phpinfo and look for _SERVER["REQUEST_URI"].
如果缺少此变量,则使用 CGI.如果变量存在并正确设置为/phpinfo.php/foobar?foo=bar,则使用 ISAPI 或 FastCGI.查看服务器 API 的输出顶部附近;它应该设置为 ISAPI(表示正在使用 ISAPI)或 CGI/FastCGI(表示正在使用 FastCGI,因为我们已经排除了 CGI).
If this variable is missing, then CGI is used. If the variable is present and correctly set to /phpinfo.php/foobar?foo=bar, then either ISAPI or FastCGI is used. Look near the top of the output for Server API; it should be set to either ISAPI (which means ISAPI is being used) or CGI/FastCGI (which means FastCGI is being used, since we already ruled out CGI).
相关文章