2 # An example of using a remote script with an Apache webserver.
3 # Run this Perl program on "otherhost" to bind port 8888 and wait
4 # for FCGI requests from the webserver.
6 ## Sample Apache configuration on the webserver to refer to the
7 ## remote script on "otherhost"
8 # <IFModule mod_fastcgi.c>
9 # AddHandler fastcgi-script fcgi
10 # FastCgiExternalServer /path-to/cgi-bin/external.fcgi -host otherhost:8888
13 # Access the URL: http://webserver/cgi-bin/external.fcgi
15 # Contributed by Don Bindner <dbindner@truman.edu>
19 my $socket = FCGI::OpenSocket( ":8888", 5 );
20 my $request = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR,
24 while( $request->Accept() >= 0 ) {
25 print "Content-type: text/html\r\n\r\n";
29 FCGI::CloseSocket( $socket );