1 package PLP::Backend::FastCGI;
6 use PLP::Backend::CGI ();
8 use base 'PLP::Backend::CGI';
10 our $VERSION = '1.01';
14 $PLP::interface = $self;
15 my $request = FCGI::Request();
19 $SIG{PIPE} = 'IGNORE';
20 while ($request->Accept() >= 0) {
21 $PLP::use_cache = !defined $ENV{PLP_CACHE} || $ENV{PLP_CACHE}; # before it's clean()ed
22 delete $ENV{PATH_TRANSLATED};
31 PLP::Backend::FastCGI - FastCGI interface for PLP
37 Add this to your configuration file (usually F</etc/lighttpd/lighttpd.conf>):
39 server.modules += ("mod_fastcgi")
40 fastcgi.server += (".plp" => ((
41 "bin-path" => "/usr/bin/perl -MPLP::Backend::FastCGI",
42 "socket" => "/tmp/fcgi-plp.socket",
44 server.indexfiles += ("index.plp")
45 static-file.exclude-extensions += (".plp")
49 You'll need a dispatch script (F<plp.fcgi> is included with PLP).
50 Example F</foo/bar/plp.fcgi>:
53 use PLP::Backend::FastCGI;
55 Then enable either I<mod_fcgid> (recommended) or I<mod_fastcgi>, and
56 setup F<httpd.conf> (in new installs just create F</etc/apache/conf.d/plp>) with:
58 <IfModule mod_fastcgi.c>
59 AddHandler fastcgi-script plp
60 FastCgiWrapper /foo/bar/plp.fcgi
63 <IfModule mod_fcgid.c>
64 AddHandler fcgid-script plp
65 FCGIWrapper /foo/bar/plp.fcgi .plp
70 This is usually the preferred backend, providing persistent processes
71 for speeds comparable to L<mod_perl|PLP::Backend::Apache> and
72 reliability closer to L<CGI|PLP::Backend::CGI>.
74 Servers often feature auto-adjusting number of daemons, script timeouts,
75 and occasional restarts.
77 =head2 Configuration directives
79 PLP behaviour can be configured by setting environment variables.
85 Sets caching off if false (0 or empty), on otherwise (true or undefined).
86 When caching, PLP saves your script in memory and doesn't re-read
87 and re-parse it if it hasn't changed. PLP will use more memory,
88 but will also run 50% faster.
94 Mischa POSLAWSKY <perl@shiar.org>
98 L<PLP>, L<PLP::Backend::CGI>, L<FCGI>