Commit | Line | Data |
637b713f |
1 | use Config; |
2 | |
3 | open OUT, ">remote.fpl"; |
4 | print OUT "#!$Config{perlpath}\n"; |
5 | print OUT while <DATA>; |
6 | close OUT; |
7 | chmod 0755, "remote.fpl"; |
8 | __END__ |
9 | # An example of using a remote script with an Apache webserver. |
10 | # Run this Perl program on "otherhost" to bind port 8888 and wait |
11 | # for FCGI requests from the webserver. |
12 | |
13 | ## Sample Apache configuration on the webserver to refer to the |
14 | ## remote script on "otherhost" |
15 | # <IFModule mod_fastcgi.c> |
16 | # AddHandler fastcgi-script fcgi |
17 | # FastCgiExternalServer /path-to/cgi-bin/external.fcgi -host otherhost:8888 |
18 | # </IfModule> |
19 | |
20 | # Access the URL: http://webserver/cgi-bin/external.fcgi |
21 | |
22 | # Contributed by Don Bindner <dbindner@truman.edu> |
23 | |
24 | use FCGI; |
25 | |
26 | my $socket = FCGI::OpenSocket( ":8888", 5 ); |
27 | my $request = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR, |
28 | \%ENV, $socket ); |
29 | |
30 | my $count; |
31 | while( $request->Accept() >= 0 ) { |
32 | print "Content-type: text/html\r\n\r\n"; |
33 | print ++$count; |
34 | } |
35 | |
36 | FCGI::CloseSocket( $socket ); |