Page 1 of 1

apache mod_fcgid server errors on shared host

Posted: Mon Jun 13, 2011 3:15 pm
by Eric!
I'm running a script on a shared host that basically does a loop with a file_get_contents on a remote URL. This script gets a lot of data over time, so I slow it down with some cheesy sleep() lines to throttle it a little. It works fine on my local server, but takes about 40 minutes. When I run it on my shared server it runs fine if I only let it run for less than about 10 minutes. However if I let it try to run it's full course I get a 500 Internal server error with the following in the error log:

[text][Mon Jun 13 12:56:06 2011] [warn] [client 187.149.xxxx] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Mon Jun 13 12:56:06 2011] [warn] [client 187.149.xxxx] (104)Connection reset by peer: mod_fcgid: ap_pass_brigade failed in handle_request function[/text]

I've spoken at length with my host provider for the past 4 days and they are idiots. They boil it down to: well, tell us how to fix it.

Since I can test the code out locally and I don't get any errors or warnings, and I can run it on the shared host if I limit the number of times it loops to prevent it from running to long...I can only guess there is some kind of server configuration issue. Has anyone seen this type of error before? I searched some on line with not much luck.

Thanks

Edit: I did find mention of someone changing the FCGI wrapper to include these lines to fix a similar problem:
[text]export PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_CHILDREN=8[/text]

I'm not sure what a FCGI wrapper is or where to find it on the shared host....

Re: apache mod_fcgid server errors on shared host

Posted: Fri Jun 17, 2011 8:29 am
by Eric!
FYI -- turns out the cheap host is killing any processes that run over 120 seconds and not telling anyone. They want my client to pay to upgrade to a dedicated server. so I designed the script to run fast and then abort gracefully every 100 seconds and pick up where it left off from when it is run again. Then I just setup multiple cron jobs to get the script to complete.