phpapachefastcgimod-fcgid

How to enable ForceType in Apache with mod_fcgid


I have mod_spdy, so I had to enable mod_fcgid for PHP per instructions from Google. The config looks like this:

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

However, now ForceType application/x-httpd-php isn't working.

This was what I had before:

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

But it's now being ignored -- i.e. the PHP is being rendered instead of preprocessed. Here's what happens:

$ 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

How can I have ForceType work with mod_fcgid?


Solution

  • Try this

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