I was getting the following error occasionally. I've search through stackoverflow but all are due to other issue (either cgi or permission) If i can load the following page occassionally (about success 644,000 times in a day and failed 8,000 times.) then I'm sure it's not about permission.
I need to reload the following page stably every 15seconds.
[Sat Aug 01 15:21:03.393569 2020] [core:error] [pid 9328:tid 15760] [client 127.0.0.1:52411] End of script output before headers: index.php, referer: http://127.0.0.1/Admin/index.php?type=14
The following is my apache setting for a 16 core, 32GB cloud instance. Running on windows server 2008 environment + apache 2.4 + PHP 7.0 ONLY. Page reload via chrome + super auto reload plus plugin.
<IfModule mpm_winnt_module>
MaxConnectionsPerChild 100000
ThreadsPerChild 1920
</IfModule>
FcgidMaxRequestLen 51200000
KeepAliveTimeout 50
MaxKeepAliveRequests 100
Timeout 600
The script is doing the calculation with PHP and refresh via timeout of JS.
JS refresh every 15s and the plugin refresh the entire page every 1 hour.
Any advice?
Related
Apache (2.4.25 FPM/FastCGI) stop responding and crashes after a while on my wordpress multisite website.
For some reason it used to run fine several days until I changed the wordpress(mu) domain using this script github.com/interconnectit/Search-Replace-DB (probably not the reason).
When restarted it works for about an hour then choked again.
I have added a mysql slow query log but its empty.
Apache error_log has multiple errors like this one:
[Wed Sep 06 08:50:27.941819 2017] [proxy_fcgi:error] [pid 25444:tid 140610719610624] (70007)The timeout specified has expired: [client x.x.x.x:53398] AH01075: Error dispatching request to : (polling)
and occasionally this error appears too:
[Wed Sep 06 09:13:33.296777 2017] [core:notice] [pid 10710:tid 140611211331392] AH00051: child pid 25582 exit signal Segmentation fault (11), possible coredump in /opt/bitnami/apache2
another occasional error (expected due to the multiple AH01075 timeout errors):
[Mon Sep 04 20:18:58.758718 2017] [mpm_event:error] [pid 19928:tid 140675798046528] AH00484: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
Stopping mysql server kills my site but seems to keep apache working fine, at least for an hour or two that i`ve been testing.
Is 457452 value is normal for mysqld.bin in the following process list? (ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS)
2128 /sbin/init
2400 php-fpm: master process (/opt/bitnami/php/etc/php-fpm.conf)
3840 -bash
4244 sshd: ubuntu [priv]
6928 /usr/bin/gonit
11036 /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnami/apache2/conf/httpd.conf -DDISABLE_BANNER
11320 /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnami/apache2/conf/httpd.conf -DDISABLE_BANNER
11364 /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnami/apache2/conf/httpd.conf -DDISABLE_BANNER
11592 /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnami/apache2/conf/httpd.conf -DDISABLE_BANNER
20592 /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnami/apache2/conf/httpd.conf -DDISABLE_BANNER
57668 php-fpm: pool wordpress
57716 php-fpm: pool wordpress
65252 php-fpm: pool wordpress
67608 php-fpm: pool wordpress
68776 php-fpm: pool wordpress
457452 /opt/bitnami/mysql/bin/mysqld.bin --defaults-file=/opt/bitnami/mysql/my.cnf --basedir=/opt/bi
PHP Version 5.6.30
mysql.bin Ver 14.14 Distrib 5.6.36
Ubuntu 14.04.5 (bitnami image on AWS)
Memory usage while apache not responding: used:883mb of 992mb
php.ini script memory_limit = 128M
Was a bit long to put it in a comment, so replying as an answer.
Are you logging any php errors? From what you presented so far, my theory would be that:
You used that script to do a search & replace of db but it executed poorly causing malformed or corrupted data.
That caused your php scripts that rely on mysql to go haywire due to malformed or corrupted data.
Because your php on fcgi isn't responding, your apache waits for it and holds onto the resources.
All the requests are hanging and now you run out of resources and start seg-faulting.
And then stupid apache, seeing that you're out of child count asks you to raise it not realizing you're already exhausted on physical resource beyond reason. Typical apache...
Because apache is now out of free children, it can't take anymore requests and it appears as if all of apache is broken even though it's merely clogged up by bad fcgi processes.
If my theory is correct, you should.
Check that none of the mysql data is corrupted
Check that the data that was replaced in mysql was as what you expected
Check for PHP error logs as they should be logging something if they can.
You should isolate the PHP processes that are actually the cause of clogging up and remove it if cleaning up data alone wasn't enough. Ideally, no matter how bad the data, the php program should've died cleanly.
Good luck hunting.
I am getting 2 errors as mentioned below.
[Fri Jan 09 04:10:23 2015] [warn] [client 188.165.15.22] mod_fcgid: read data timeout in 31 seconds
[Fri Jan 09 04:10:23 2015] [error] [client 188.165.15.22] Premature end of script headers: index.php
I checked this Premature end of script headers: index.php, mod_fcgid: read data timeout in 61 seconds also. But I do not have any file like /etc/httpd/conf.d/fcgid.conf to edit.
Does anybody have any idea?
I don't think that there might be any issue with php script as it as been working fine from past 1 year. Now all of sudden it has stopped working.
My Apache version is 2.2.22 and PHP Version 5.3.10-1ubuntu3.13
Content of fcgid.conf:
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
FcgidConnectTimeout 20
FcgidIOTimeout 2000
</IfModule>
You can increase the timeout as indicated in the other post:
FcgidIOTimeout 600
But since you are on Ubuntu, you'll find the relevant configuration file here:
/etc/apache2/mods-available/fcgid.conf
For me it was 41 seconds and it was coming from the httpd.conf file of the site
# /etc/apache2/sites-available/website.com.conf
<VirtualHost ipv4:80 [ipv6]:80>
IPCCommTimeout 600 #increased from 41
</VirtualHost>
If you're using FcgidCmdOptions, see answer to this question - mod_fcgid read timeout from pipe, end of script output before headers, multiple versions of PHP . In short - global options are ignored for the program specified in FcgidCmdOptions, so all timeouts have to be configured directly in this instruction.
In my Plesk 11, PHP 5.4.7. Apache/2.4.3 system, when I make cron jobs I get this error from error.log file.
[Tue Mar 19 21:33:18 2013] [warn] [client 88.44.55.66] mod_fcgid: read data timeout in 45 seconds
[Tue Mar 19 21:33:18 2013] [error] [client 88.44.55.66] Premature end of script headers: index.php
So I checked for execution time with this:
echo ini_get('max_execution_time');
I got this value: 1560000
It doesn't seem a timeout problem but I get timeout error?
Answer for the future reference:
Edit /etc/httpd/conf.d/fcgid.conf file with vim.
Change FcgidIOTimeout 45 to FcgidIOTimeout 600.
Restart Apache.
Then Fast CGI timeout will be solved.
That's a mod_fcgid timeout, not a PHP timeout. Take a look at the mod_fcgid documentation to find out how to change it, especially at FcgidIOTimeout.
Cron scripts if build correctly should not be run through apache. Your error shows that you are running into a timeout set by mod_fcgi.
If you access it through http in your cronjob, then it will work as a webpage request and then it may be affected by apache timeout because apache is involved in the process. You can run the php script directly with an absolute path using php interpreter to bypass apache
PHP support is currently set to: run as Fast CGI.
I keep getting these errors in my server log:
mod_fcgid: read data timeout in 45 seconds
Premature end of script headers: index.php
Should be quick fix I think, but I cant find the file to edit. Is this something I can change from Plesk.
Anyone know how to increase the timeout?
In Plesk 12.x and similar go to Web Server Settings and set the following directives:
Additional directives for HTTP & HTTPS
FcgidBusyTimeout 300
FcgidIOTimeout 250
Above lines will change the timeout for scripts that are quiet too long and take too long to execute.
Additional nginx directives
proxy_read_timeout 300;
Above lines will change the proxy timeout.
If the problem persist, increase the values.
See also: Premature end of script headers: index.php, mod_fcgid: read data timeout
Check the screenshots for the guidance:
A solution provided in the forum of Plesk by Parallels staff
Edit the file:
/etc/httpd/conf.d/fcgid.conf
Specifically, change
FcgidIOTimeout 45
to
FcgidIOTimeout 3600
3600 seconds = 1 hour. Should be long enough for most but adjust
upwards if required. I saw one example quoting 7200 seconds in there.
Finally, restart Apache to make the new setting active.
apachectl graceful
Hope it helps
R
My solution to this was to change the PHP settings in the plesk control pannel as per the screenshot.PHP Settings
In the new version of Plesk the fcgid.conf file has moved to:
/etc/apache2/mods-available/fcgid.conf
I had some issues importing an xml file into wordpress. It kept on giving a 500 Internal Error. The error log showed:
[Wed Jul 26 13:18:00.219226 2017] [fcgid:warn] [pid 4751] [client
145.97.205.8:60155] mod_fcgid: read data timeout in 45 seconds
[Wed Jul 26 13:18:00.219505 2017] [fcgid:warn] [pid 4751]
(110)Connection timed out: [client 145.97.205.8:60155] mod_fcgid:
ap_pass_brigade failed in handle_request_ipc function
After following some advice - as the PHP.INI settings made no difference - i changed some settings as advised:
Original:
FcgidIOTimeout 45
To:
FcgidIOTimeout 3600
Also added:
<IfModule mod_fcgid.c>
FcgidMaxRequestsPerProcess 500
<IfModule !mod_fastcgi.c>
Worked like a charm. Thank you for your help.
After changing max_execution_time = 3600 in /etc/php.ini solved my problem.
I've a script which send just a lot of data in json format
by post.
Up to about 10Mb (data are put into a flat file) of data the script works great but
if the load is higher I get from apache 500 Internal Server Error.
I peeped into apache log file I get
[Wed Jan 19 17:26:41 2011] [error] [client ip] Premature end of script headers: index.php
[Wed Jan 19 17:26:41 2011] [debug] mod_deflate.c(615): [client ip] Zlib: Compressed 632 to 385 : URL /index.php
Do you have any idea about it ?
Bye.
Premature end of script headers
This message means the PHP script died before outputing any content-type to apache. If you have ob_* functions activated it could be any error on your PHP script, or a timeout, check your set-time-limit parameter in PHP for timeouts.
Check as well that your exception handling output the correct content type if you want to output an error message.
To check all parameters that can have an impact you must check the timeout parameters and the size limits ones. Here are some of them:
Apache:
LimitRequestBody
PHP:
post_max_size
upload_max_filesize
max_input_time
max_execution_time
and maybe memory_limit as well