Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

FastCGI test script (See related posts)

If you're having trouble with FastCGI (as I was), this Perl script can help you see if the problem is at the Apache end or the app end. In my case I'd simply not deleted the old Ruby sessions for my Rails app when switching from CGI to FCGI ;-) This script proved my Apache wasn't broken, at least.

#!/usr/bin/perl

use FCGI;

$cnt = 0;

while (FCGI::accept() >= 0)
{
   print ("Content-type: text/html\r\n\r\n");
   print ("<head>\n<title>FastCGI Demo Page (perl)</title>\n</head>\n");
   print  ("<h1>FastCGI Demo Page (perl)</h1>\n");
   print ("This is coming from a FastCGI server.\n<BR>\n");
   print ("Running on <EM>$ENV{USER}</EM> to <EM>$ENV{REMOTE_HOST}</EM>\n<BR>\n");
    $cnt++;
   print ("This is connection number $cnt\n");
}

You need to create an account or log in to post comments to this site.


Click here to browse all 4852 code snippets

Related Posts