Re: SetHandler and AddHandler ignored

"Rob Saccoccio" <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <0CE757914FCC4DC7AB066D4835B5D0EE@maisel>
> Here's an example config. php-cgi is running in fastcgi mode on
> localhost:9000. I want PHP files (*.php) to be sent to this php-cgi
> daemon and everything else to be served statically by apache. The
> AddHandler statement should do this.
> 
> ---BEGIN---
> <VirtualHost *:80>
>         ServerName www.example.com
>         DocumentRoot /home/user/webs/www.example.com
>         AddHandler fastcgi-script .php
> </VirtualHost>
> FastCGIExternalServer /home/user/webs/www.example.com -host 127.0.0.1:9000
> ---END---
> 
> What happens is that regardless of the file extention, everything is
> passed to the php daemon running on localhost, php, javascript, images
> and css. Unless you tell it otherwise, PHP serves content as text/html.
> The result is that css and javascript have the wrong content type.

To do what you want, the path in the FastCGIExternalServer directive should
not be a directory.  You want something like this (see
http://www.fastcgi.com/docs/faq.html#PHP and the PHP docs):

<VirtualHost *:80>
        ServerName www.example.com
        DocumentRoot /home/user/webs/www.example.com
        Action php-fastcgi <php-path>
        AddHandler php-fastcgi .php
</VirtualHost>
FastCGIExternalServer <php-path> -host 127.0.0.1:9000

Where <php-path> is someplace outside of your servers' document root or is
inside but is not a directory.

This will define a new handler type called php-fastcgi and associate it with
php-path.  

> If you remove the fixups function, which explicitly sets the handler for
> requests to fastcgi-script, everything works as it should.

Funny how that is.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.