前几天得到消息,说是 BlueHost 开始支持 FastCGI 。我使用的空间 HostMonster 其实和 BlueHost 是同一家公司,今天到管理后台看到了这个 FastCGI 的选项,启用后出现问题,表现在:使用 http://pihai.net 无法访问;分页页面(http://www.pihai.net/page/2)无法显示;期间用 http://www.pihai.net 形式访问还出现过服务器错误(忘记截图了) 。

提示出现301错误及500错误,根据GG搜索结果及官方论坛的一些资料,最终在 HostMonster 的 Support Center 找到问题所在
Potential Problems:
- You will only have one php.ini file available for all subdirectories (/home/USERNAME/public_html/php.ini). This is necessary to help optimize the website code as much as possible. If you need multiple php.ini files to accommodate different scripting needs, you can disable FastCGI for PHP on any of your subdirectories while leaving the rest of the account enabled for performance. Please contact support if you need to do this.
- There can be a few minute delay in any updates you make to your PHP environment (ie, php.ini changes). Since your php.ini is loaded into memory for greater speed, every hit does not re-read it from storage.
看来引起错误的关键是因为,启用了 FastCGI 将导致 subdirectories 下的 php.ini 文件失效,我空间的主域名是 pigbb.net ,addon 了现在的博客域名 pihai.net ,同时还启用了 permalink_redirect 这款插件,所以出现上面的问题。那么若空间只有一个主域名,可能就不会出现这样的问题了。生活点滴启用 FastCGI 后也出现了问题,但他没有具体描述。目前看来,除了上面的原因,还有可能 WordPress 程序本身没有针对 FastCGI 进行优化,在《FastCGI中文参考手册》一文中我们可以看到:FastCGI应用程序对编写者提出了一种严格要求的挑战。……FastCGI程序为长生存期应用程序,如在设计中有缺陷会产生内存溢出问题,对服务器造成安全隐患。 所以在没有找到根本的解决方案前,还是建议暂不开启 FastCGI for PHP。
若排除 WordPress 程序本身不适合运行在 FastCGI 模式下,类似我出现的问题,是否可以通过单修改 .htaccess 来实现转向,而同时可以使用 FastCGI 呢? WordPress 中那个永久链接功能,看来并没有修改 php.ini 文件。
欢迎各位达人指教。
Tags:FastCGI HostMonster 阅读3272次





July 7th, 2007 at 12:01 pm
对于fastcgi模式我一直抱有谨慎的态度,毕竟php最初没有这方面的设计考虑,或许到了php6我们可以看到这方面的东西了。以前在哪里看到php6中PEAR的好多类都不能用了,可以考虑向zend靠拢了。BH的fast-cgi先别忙用的好
July 7th, 2007 at 1:24 pm
感谢生活点滴的点评。
July 22nd, 2007 at 7:46 pm
建议继续使用短的域名。
July 23rd, 2007 at 8:08 am
谢谢 活龙 的建议
July 2nd, 2008 at 9:37 am
将子目录中的php.ini全部删除,FastCGI只允许根目录有一个php.ini文件,否则会出错!
You will only have one php.ini file available for all subdirectories (/home/USERNAME/public_html/php.ini). This is necessary to help optimize the website code as much as possible. If you need multiple php.ini files to accommodate different scripting needs, you can disable FastCGI for PHP on any of your subdirectories while leaving the rest of the account enabled for performance. Please contact support if you need to do this.
参考这里:http://helpdesk.hostmonster.com/kb/index.php?x=&mod_id=2&id=350