httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ross Garinger <>
Subject [users@httpd] mod_fcgid setting content-type header
Date Wed, 23 May 2012 17:22:37 GMT

I am running PHP through mod_fgcid using the following setup in a conf file:

<IfModule !mod_php4.c>
<IfModule !mod_php4_filter.c>
<IfModule !mod_php5.c>
<IfModule !mod_php5_filter.c>
<IfModule !mod_php5_hooks.c>
<IfModule mod_actions.c>
<IfModule mod_alias.c>
<IfModule mod_mime.c>
<IfModule mod_fcgid.c>
<IfModule mod_headers.c>
        DefaultInitEnv  PHPRC=/etc/php5/cgi
        #DefaultInitEnv PHP_FCGI_MAX_REQUESTS 5000

        AddHandler php-fcgi .php .css
        Action php-fcgi /fcgi-bin/php-fcgi-wrapper
        AddType application/x-httpd-php .php .css
        <FilesMatch "\.css$">
                Header set Content-type "text/css"

        Alias /fcgi-bin/ /var/www/fcgi-bin.d/php5-default/
        <Location /fcgi-bin/>
                SetHandler fcgid-script
                Options +ExecCGI
                Order Allow,Deny
                Allow from All

As you can see, in addition to parsing .php files as PHP, I am also parsing
.css files as PHP. This is indeed working, however the Content-type is not
being set correctly in the response headers from my server. The
Content-type for .css files is still text/html. I added the <FilesMatch
"\.css$"> directive to try to set the Content-type, but that is not
working. I'm guessing that the fact that I'm using mod_fcgid has something
to do with this, as the mod_fcgid processing is probably rewriting the
Content-type to text/html after I set it to text/css? I've tried several
different permutations including the ForceType directive, but I just can't
get the Content-type set correctly. The only approach I've found that works
is to stick a header("Content-type: text/css") at the top of my css files,
which is inconvenient to say the least. Anyone have a solution for this?


View raw message