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:<br>
<br>#include <fcgi_stdio.h><br><br>int main(void){<br> int count = 0;<br> while(FCGI_Accept()>=0){<br> printf("Content-Type: text/html\r\n");<br> printf("\r\n");<br> printf("Hello, World: %d", count++);<br>
}<br> return 0;<br>}<br><br>Now I compile Fcgi.hs to <web root>/fastcgi/test2.fcgi:<br><br>import Control.Concurrent<br>import Network.FastCGI<br><br>action :: CGI CGIResult<br>action = do<br> setHeader "Content-type" "text/plain"<br>
tid <- liftIO myThreadId<br> output $ unlines <br> [ "I am a FastCGI process!"<br> , "Hear me roar!"<br> , ""<br> , show tid<br> ]<br>
<br>main = runFastCGIConcurrent' forkIO 10 action<br><br><br>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:<br>
<br>[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<br>[Mon Aug 09 11:11:23 2010] [warn] FastCGI: (dynamic) server "/var/www/fastcgi/test.fcgi" started (pid 20354)<br>
[Mon Aug 09 11:11:27 2010] [warn] FastCGI: (dynamic) server "/var/www/fastcgi/test2.fcgi" started (pid 20360)<br>[Mon Aug 09 11:11:31 2010] [warn] FastCGI: (dynamic) server "/var/www/fastcgi/test2.fcgi" started (pid 20365)<br>
[Mon Aug 09 11:11:34 2010] [warn] FastCGI: (dynamic) server "/var/www/fastcgi/test2.fcgi" started (pid 20371)<br>[Mon Aug 09 11:11:37 2010] [warn] FastCGI: (dynamic) server "/var/www/fastcgi/test2.fcgi" started (pid 20375)<br>
[Mon Aug 09 11:11:40 2010] [warn] FastCGI: (dynamic) server "/var/www/fastcgi/test2.fcgi" started (pid 20379)<br>[Mon Aug 09 11:11:43 2010] [warn] FastCGI: (dynamic) server "/var/www/fastcgi/test2.fcgi" started (pid 20383)<br>
[Mon Aug 09 11:11:46 2010] [warn] FastCGI: (dynamic) server "/var/www/fastcgi/test2.fcgi" started (pid 20387)<br>[Mon Aug 09 11:11:49 2010] [warn] FastCGI: (dynamic) server "/var/www/fastcgi/test2.fcgi" started (pid 20391)<br>
[Mon Aug 09 11:11:52 2010] [warn] FastCGI: (dynamic) server "/var/www/fastcgi/test2.fcgi" started (pid 20395)<br>[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)<br>
[Mon Aug 09 11:11:55 2010] [warn] FastCGI: (dynamic) server "/var/www/fastcgi/test2.fcgi" started (pid 20399)<br>[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)<br>
[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"<br><br>I've tried Fcgi.hs with two different sample FastCGI programs with the same results. Any suggestions?<br>
<br>Wayne<br>