I'm building a site for a client using django. It's been hosted on shared hosting and mod_wsgi can't be used. In the old year, I got it working using fcgi, but when I got back, it was broken.
I have replaced the fcgi script with a simple hello world script:
#!/usr/bin/python
def myapp(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
return ['Hello World!\n']
try:
from flup.server.fcgi import WSGIServer
WSGIServer(myapp).run()
except:
import sys, traceback
traceback.print_exc(file=open("errlog.txt","a"))
Tested and working on my local server, but on the hosted server, I get this error:
<title>FCGI Error</title>
A timeout occured while waiting for the script output (in: /usr/www/users/mymemb/).
If I look at the error log, I see this:
[Wed Jan 6 16:59:37 2010] [warn] FastCGI: (dynamic) server "/usr/www/users/mymemb/mymembers.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 10 seconds
[Wed Jan 6 16:59:38 2010] [warn] FastCGI: (dynamic) server "/usr/www/users/mymemb/mymembers.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 10 seconds
[Wed Jan 6 16:59:38 2010] [warn] FastCGI: (dynamic) server "/usr/www/users/mymemb/mymembers.fcgi" (user mymemb, gid 100) restarted (pid 1057)
[Wed Jan 6 16:59:38 2010] [warn] FastCGI: (dynamic) server "/usr/www/users/mymemb/mymembers.fcgi" (pid 1057) terminated by calling exit with status '118'
[Wed Jan 6 16:59:38 2010] [warn] FastCGI: (dynamic) server "/usr/www/users/mymemb/mymembers.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 10 seconds
[Wed Jan 6 16:59:38 2010] [warn] FastCGI: (dynamic) server "/usr/www/users/mymemb/mymembers.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 10 seconds
[Wed Jan 6 16:59:38 2010] [warn] FastCGI: (dynamic) server "/usr/www/users/mymemb/mymembers.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 10 seconds
etc ...
If I ssh to the server, I can run the script fine, with the following output:
mymemb@www81:~/public_html$ ./mymembers.fcgi
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
Status: 200 OK
Content-Type: text/plain
Content-Length: 13
Hello World!
How do I fix this?
Added info:
It seems like the script is not running at all. If I add import x at the top of the script, and run it from ssh, I see that x.pyc gets created. If I rm x.pyc, and then hit the site, x.pyc does not get created.
I also noticed that the errors changed from
terminated by calling exit with status '118'
to
terminated by calling exit with status '116'
I wish I could find a reference for these exit statuses.