Connection reset by peer: mod_fcgid: error reading

2019-01-11 06:03发布

I am having issue on PHP where my app is trying to run a php backup file and suddenly getting HTTP Error 500 Code. I have checked the logs and this what it saying.

[Tue Aug 28 14:17:28 2012] [warn] [client x.x.x.x] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: http://example.com/backup/backup.php
[Tue Aug 28 14:17:28 2012] [error] [client x.x.x.x] Premature end of script headers: backup.php, referer: http://example.com/backup/backup.php

Anyone knows how to fix this? I'm really stuck in here and can't find solution in internet.

Hope anyone could share their knowledge.

Thanks. James

15条回答
唯我独甜
2楼-- · 2019-01-11 06:27

I got the same problem (with Plesk 12 installed). However, when i switched from execute PHP as FastCGI to Apache Module the website worked.

Checked my suexec log:

$ cd /var/log/apache2/
$ less suexec.log

When you find something like this:

[2015-03-22 10:49:00]: directory is writable by others: (/var/www/cgi-bin/cgi_wrapper)
[2015-03-22 10:49:05]: uid: (10004/gb) gid: (1005/1005) cmd: cgi_wrapper

try this commands

$ chown root:root /var/www/cgi-bin/cgi_wrapper
$ chmod 755 /var/www/cgi-bin/cgi_wrapper
$ shutdown -r now

as root.

I hope it can help you.

查看更多
Luminary・发光体
3楼-- · 2019-01-11 06:32

Not in this questions askers case but often:

What does the "premature end of script headers" error mean?

That error means that the FCGI call was exited unexpectedly.

In some cases it means that the script "backup.php" did crash.

How to fix this?

If the crash of a script was the cause, fix the script so that it does not crash. Then this error is fixed, too. To find out if and why a script crashes, you need to debug it. For example you can check the PHP error log. Errors logged to STDERR normally go into the error handler of the FCGI.

查看更多
萌系小妹纸
4楼-- · 2019-01-11 06:33

The famous Moodle "replace.php" script can generate this situation too. For me it was taking ages to run and then failed with a 500 message in the browser and also with the above error message in my apache error log file.

I followed up on @james-wise answer: FcgidBusy is readably described in the Apache documentation. I tried this: doubled the amount of time which apache would give my script to run, by inserting the following line in /etc/apache2/mods-available/fcgid.conf

FcgidBusyTimeout 600

Then I restarted Apache and tried to run my replace.php script again.

Fortunately this time the script instance ran to completion, so for my purposes this served as a solution.

查看更多
登录 后发表回答