[Catalyst] Anyone actually using FastCGI with Apache (or even lighttpd)?
Daisuke Maki
daisuke at endeworks.jp
Tue Aug 29 03:02:30 CEST 2006
I just got bit by this last night with lighttpd + FastCGI and was
wondering, too. My quick and dirty fix for lighttpd was
$path = $base_path . ($ENV{PATH_INFO} || $ENV{SCRIPT_NAME} || '');
in Catalyst::Engine::CGI.
However, after some sleep and reading other solutions, it does seem that
subclassing the App or a base controller class would be better.
is this a problem with FastCGI + Catalyst 5.7+? I was vaguely thinking
that this is a problem with lighttpd + FastCGI, but OP's report suggests
that it doesn't work on Apache either, so...
--d
Mark Blythe wrote:
> 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:
>
> http://lists.rawmode.org/pipermail/catalyst/2006-June/008361.html
>
> I have this in my app as a Catalyst plugin.
>
> Mark
>
> 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:
>>
>>SCRIPT_NAME = '/'
>>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/
>>
>
>
> _______________________________________________
> 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