[Catalyst] Anyone actually using FastCGI with Apache (or even lighttpd)?

Mark Blythe list at markblythe.com
Mon Aug 28 23:18:46 CEST 2006

Hey Jason,

I think you're having the same problem I had back in June.  I was
amazed that nobody else seemed to have been having this issue.  I
guess it just took a few months. :-)

Anyway, here's the solution message I posted, which has been working
fine for me since then.  Take a look and see if it will work for you:


I have this in my app as a Catalyst plugin.


On 8/28/06, Jason Kohles <email at jasonkohles.com> wrote:
> I've been struggling for a while now to get an app working under
> FastCGI, mostly under Apache, although I did briefly experiment with
> lighttpd, it gave me the same results.
> In a nutshell, the problem is this, I setup an application using this
> configuration (which I found in the documentation):
> FastCgiExternalServer /tmp/test -socket /tmp/test.socket
> <VirtualHost *:80>
>         ServerName test.domain.com
>         ServerAdmin webmaster at domain.com
>         DocumentRoot /var/www/html
>         Alias / /tmp/test/
> </VirtualHost>
> When running a Catalyst app with this configuration, what happens is
> that any URL that is one level off the root, and ends with a / ends up
> at the main controllers index method.  You can demonstrate this with a
> very basic modification of a generic application, just use
> 'catalyst.pl Test' to create a test app, then put these two methods in
> Controller::Root:
> sub default : Private {
>     my ( $self, $c ) = @_;
>     $c->response->body( "This is default" );
> }
> sub index : Private {
>     my ( $self, $c ) = @_;
>     $c->response->body( "This is index" );
> }
> Loading this application as http://test.domain.com/ should return
> 'This is index', while any other url on the server should say 'This is
> default'.  What happens however, is that if you request a URL such as
> http://test.domain.com/foo/, you also get 'This is index'.
> The reason for this is that Catalyst::Engine::FastCGI inherits from
> Catalyst::Engine::CGI.  Catalyst::Engine::CGI::prepare_path() has this
> code:
>     $base_path = $ENV{SCRIPT_NAME} || '/';
> When using the CGI interface, this works fine, and most of the time
> this seems to work fine for FastCGI as well, except when you use URL
> such as http://test.domain.com/foo/, what happens is that Apache (or
> mod_fastcgi) sets up these environment variables as:
> SCRIPT_NAME = '/foo'
> PATH_INFO = '/'
> Rather than the values you would expect them to have, which should be:
> PATH_INFO = '/foo'
> This seems to be a fairly common problem (there are bugs that mention
> similar behaviour in the bug tracking queues for lighttpd, rt, trac,
> zope, and several others), although I haven't been able to find a
> solution anywhere.
> I'm trying to use fastcgi with the external server so that I can have
> different apps using different perl installs for deployment purposes,
> which is a lot trickier with mod_perl, although if I can't get this
> working, I may have to bite the bullet and see about doing something
> ugly with mod_perl to make it happen.
> --
> Jason Kohles
> email at jasonkohles.com - http://www.jasonkohles.com/
> "A witty saying proves nothing."  -- Voltaire
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/

More information about the Catalyst mailing list