如何使用mod_fcgid在Apache中启用ForceType

时间:2012-12-28 15:20:41

标签: php apache fastcgi mod-fcgid

我有mod_spdy,因此我必须为PHP per instructions from Google启用mod_fcgid。配置如下所示:

<Location />
AddHandler fcgid-script .php
Options +ExecCGI
FcgidWrapper /usr/bin/php-cgi .php
</Location>

但是,现在ForceType application/x-httpd-php无效。

这就是我之前所拥有的:

<FilesMatch (index.html|foo|bar)>
ForceType application/x-httpd-php
</FilesMatch>

但它现在被忽略了 - 即PHP正在呈现而不是预处理。这是发生的事情:

$ curl -i http://blahblah.ca/
HTTP/1.1 200 OK
Date: Fri, 28 Dec 2012 15:19:22 GMT
Server: Apache/2.2.22 (Ubuntu)
Last-Modified: Wed, 07 Apr 2010 20:49:57 GMT
ETag: "494bb1-676-483abb4742740"
Accept-Ranges: bytes
Content-Length: 1654
Vary: Accept-Encoding
Content-Type: application/x-httpd-php

如何让ForceType与mod_fcgid配合使用?

1 个答案:

答案 0 :(得分:2)

试试这个

<FilesMatch (index.html|foo|bar)>
  SetHandler fcgid-script
  FCGIWrapper /usr/bin/php-cgi
</FilesMatch>