[Haskell-beginners] FastCGI error

Dmitry Simonchik dima at simonchik.net
Thu Aug 12 02:57:14 EDT 2010


I beleive the problem is in your Apache config as your program seems to be
correct. You can doublecheck it if use plain CGI instead of FastCGI (just
change import and use runCGI) and run the programm from console. You should
see the output.

On Tue, Aug 10, 2010 at 9:35 PM, Wayne R
<reginald.wayne.richards at gmail.com>wrote:

> I'm trying to use Network.FastCGI with Apache2, but running into an error.
> I'd like to believe that the web server is configured correctly, because I
> can successfully view the following, compiled to <web
> root>/fastcgi/test.fcgi:
>
> #include <fcgi_stdio.h>
>
> int main(void){
>   int count = 0;
>   while(FCGI_Accept()>=0){
>    printf("Content-Type: text/html\r\n");
>    printf("\r\n");
>    printf("Hello, World: %d", count++);
>   }
>   return 0;
> }
>
> Now I compile Fcgi.hs to <web root>/fastcgi/test2.fcgi:
>
> import Control.Concurrent
> import Network.FastCGI
>
> action :: CGI CGIResult
> action = do
>         setHeader "Content-type" "text/plain"
>         tid <- liftIO myThreadId
>         output $ unlines
>             [ "I am a FastCGI process!"
>             , "Hear me roar!"
>             , ""
>             , show tid
>             ]
>
> main = runFastCGIConcurrent' forkIO 10 action
>
>
> When I view localhost/fastcgi/test.fcgi, I get the hello world page, but
> attempting to view test2.fcgi shows an 'Internal Server Error" in firefox.
> The apache error log says:
>
> [Sun Aug 08 07:44:17 2010] [notice] Apache/2.2.14 (Ubuntu)
> mod_fastcgi/2.4.6 mod_lisp2/1.3.1 PHP/5.3.2-1ubuntu4.2 with Suhosin-Patch
> mod_ssl/2.2.14 OpenSSL/0.9.8k configured -- resuming normal operations
> [Mon Aug 09 11:11:23 2010] [warn] FastCGI: (dynamic) server
> "/var/www/fastcgi/test.fcgi" started (pid 20354)
> [Mon Aug 09 11:11:27 2010] [warn] FastCGI: (dynamic) server
> "/var/www/fastcgi/test2.fcgi" started (pid 20360)
> [Mon Aug 09 11:11:31 2010] [warn] FastCGI: (dynamic) server
> "/var/www/fastcgi/test2.fcgi" started (pid 20365)
> [Mon Aug 09 11:11:34 2010] [warn] FastCGI: (dynamic) server
> "/var/www/fastcgi/test2.fcgi" started (pid 20371)
> [Mon Aug 09 11:11:37 2010] [warn] FastCGI: (dynamic) server
> "/var/www/fastcgi/test2.fcgi" started (pid 20375)
> [Mon Aug 09 11:11:40 2010] [warn] FastCGI: (dynamic) server
> "/var/www/fastcgi/test2.fcgi" started (pid 20379)
> [Mon Aug 09 11:11:43 2010] [warn] FastCGI: (dynamic) server
> "/var/www/fastcgi/test2.fcgi" started (pid 20383)
> [Mon Aug 09 11:11:46 2010] [warn] FastCGI: (dynamic) server
> "/var/www/fastcgi/test2.fcgi" started (pid 20387)
> [Mon Aug 09 11:11:49 2010] [warn] FastCGI: (dynamic) server
> "/var/www/fastcgi/test2.fcgi" started (pid 20391)
> [Mon Aug 09 11:11:52 2010] [warn] FastCGI: (dynamic) server
> "/var/www/fastcgi/test2.fcgi" started (pid 20395)
> [Mon Aug 09 11:11:55 2010] [warn] FastCGI: scheduled the start of the last
> (dynamic) server "/var/www/fastcgi/test2.fcgi" process: reached
> dynamicMaxClassProcs (10)
> [Mon Aug 09 11:11:55 2010] [warn] FastCGI: (dynamic) server
> "/var/www/fastcgi/test2.fcgi" started (pid 20399)
> [Mon Aug 09 11:12:01 2010] [error] [client 127.0.0.1] FastCGI: comm with
> (dynamic) server "/var/www/fastcgi/test2.fcgi" aborted: (first read) idle
> timeout (30 sec)
> [Mon Aug 09 11:12:01 2010] [error] [client 127.0.0.1] FastCGI: incomplete
> headers (0 bytes) received from server "/var/www/fastcgi/test2.fcgi"
>
> I've tried Fcgi.hs with two different sample FastCGI programs with the same
> results.  Any suggestions?
>
> Wayne
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20100812/cdd5a2da/attachment.html


More information about the Beginners mailing list