我试图在apache 2下使用FastCGI(mod-fcgid)和worker MPM运行PHP。 我用这个博客文章作为参考。
看来我已经有一切工作,除了一件事情:
当apache隐式地使用index.php(使用mod_dir,我认为)时,它不使用为.php文件configuration的处理程序,只是为PHP文件提供静态内容。
但是,当我手动添加index.php部分的URL,它确实使用处理程序,一切似乎工作。 其他PHP文件也可以正常工作。
澄清:
什么可能导致这个? 任何提示都表示赞赏!
编辑:一些更多的细节:这是一个Ubuntu无畏系统。
我通过将两个PHP行添加到mods-enabled / fcgid.conf中来获得在FastCGI中工作的.php,现在看起来像这样:
<IfModule mod_fcgid.c> AddHandler fcgid-script .fcgi IPCConnectTimeout 20 AddHandler fcgid-script .php FCGIWrapper /usr/lib/cgi-bin/php5 .php </IfModule>
目录索引在mods-enabled / dir.conf中configuration:
<IfModule mod_dir.c> DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm </IfModule>
我不需要把Options + ExecCGI放在任何地方。 其实,我只是尝试注释在网站启用/ 000默认的块,FastCGI PHP仍然工作正常,除了隐式index.php
我想知道你是否使用mod_index是通过vhost的fastcgi(即分离的设置使用php处理程序的虚拟主机)。
这可能是愚蠢的,但尝试:
<IfModule mod_fcgid.c> AddHandler fcgid-script .fcgi IPCConnectTimeout 20 AddHandler fcgid-script .php FCGIWrapper /usr/lib/cgi-bin/php5 .php DirectoryIndex index.php </IfModule>
当Apache模块以奇怪的方式进行交互时,我发现了一些奇怪的东西。 当然有时在configuration文件中的顺序是非常重要的。
哦,我一直很愚蠢。
显然我只是在一个时间点configuration错了,而我的浏览器caching了不正确的响应。
http://example.com/index.php然后工作,可能是因为我只是开始尝试后,我得到了FastCGI PHP的工作,所以没有不正确的响应是在caching中。
换句话说,我原来的问题中的信息是mod-fcgid中mpm-worker + PHP的工作configuration!
感谢您的努力:-)