fix exit constants usage in apache2
[perl/plp/.git] / PLP / FastCGI.pm
1 package PLP::FastCGI;
2
3 use strict;
4
5 use PLP::CGI;
6 use FCGI;
7 use base 'PLP::CGI';
8
9 our $VERSION = '1.00';
10
11 sub import {
12         my $self = shift;
13         my $request = FCGI::Request();
14         while ($request->Accept() >= 0) {
15                 $PLP::use_cache = !defined $ENV{PLP_CACHE} || $ENV{PLP_CACHE}; # before it's clean()ed
16                 delete $ENV{PATH_TRANSLATED};
17                 $self->everything();
18         }
19 }
20
21 1;
22
23 =head1 NAME
24
25 PLP::FastCGI - FastCGI interface for PLP
26
27 =head1 SYNOPSIS
28
29 =head2 Lighttpd
30
31 Edit the configuration file (usually F</etc/lighttpd/lighttpd.conf>)
32 to enable I<mod_fastcgi> (add/outcomment in server.modules), and add:
33
34     fastcgi.server = (
35         ".plp" => ((
36             "bin-path" => "/usr/bin/perl -MPLP::FastCGI",
37             "socket" => "/tmp/fcgi-plp.socket",
38         )),
39     )
40
41 =head2 Apache
42
43 You'll need a dispatch script (F<plp.fcgi> is included with PLP).
44 Example F</foo/bar/plp.fcgi>:
45
46     #!/usr/bin/perl
47     use PLP::FastCGI;
48
49 Then enable either I<mod_fastcgi> or I<mod_fcgid>, and setup F<httpd.conf>
50 (often just create a F</etc/apache2/conf.d/plp>) with:
51
52     <IfModule mod_fastcgi.c>
53         AddHandler fastcgi-script plp
54         FastCgiWrapper /foo/bar/plp.fcgi
55     </IfModule>
56
57     <IfModule mod_fcgid.c>
58         AddHandler fcgid-script plp
59         FCGIWrapper /foo/bar/plp.fcgi .plp
60     </IfModule>
61
62 =head1 AUTHOR
63
64 Mischa POSLAWSKY <perl@shiar.org>
65
66 =head1 SEE ALSO
67
68 L<PLP|PLP>, L<PLP::CGI|PLP::CGI>, L<FCGI|FCGI>
69