cloudControl - timeouts and fastcgi errors - php

During the past days, we almost always encountered timeouts on our PHP-application while the cloudControl error logfile displayed
Error [error] [client ...] FastCGI: incomplete headers (0 bytes) received from server "/app/php/box/php-fpm"
Error [error] [client ...] FastCGI: comm with server "/app/php/box/php-fpm" aborted: idle timeout (120 sec)
Will there be an issue with the standard memory limit settings and if so, what would be the best way to fix it? Thanks in advance.

the error which you are observing in the log often comes from a too long running php process. The runtime is restricted to 120 seconds. In most of the cases, if your application 'suddenly' starts to print out these messages, it hast something to do with external services (database, web services, ...), which are answering slower than expected. If this is the case, it is a good practice to configure timeouts (socket) and handle the error case, to prevent your application being affected by other services.
I hope it helps.

Related

FastCGI: comm with server aborted: read failed

One of the php sites hosted on my shared linux/Apache server keeps getting random 500 Internal Server Error, while other sites never encounter any issues. The server error log shows:
Handler for fastcgi-script returned invalid result code 1
Connection reset by peer: FastCGI: comm with server "/usr/lib/cgi-bin/php5-fcgi" aborted: read failed
Is this an application specific issue or server configuration issue? Thanks!
It seems your script is over max_execution_time. Maybe 360s
It could be very useful to get which function is consuming most of the execution time. You can use the slow log of php-fpm.
In your pool file (/etc/php5/fpm/pool.d/www.conf) look for:
'slowlog', and add a log file like: '/var/log/php-fpm/www.log.slow'
'request_slowlog_timeout', and add a time like: '10s'
Restart php-fpm, tailf this file and maybe you could trace your huge function.

500 Internal Server Error Laravel

Sometimes i got this error: 500 Internal Server Error
My PHP Version 5.4.4-14+deb7u14
My Laravel Version "laravel/framework": "4.2.*"
Apache Server
My DocumentRoot & Directory in httpd.conf is set to: /usr/local/sites/mysite-laravel/public
My server logs:
(104)Connection reset by peer: mod_fcgid: ap_pass_brigade failed in handle_request_ipc function
[Mon Sep 01 14:52:33 2014] [error] mod_fcgid: process /var/www-data/fcgi-bin/php5-fcgi(25404) exit(communication error), get unexpected signal 11
Does anyone know about this? or is this is what happens in Laravel 4?
Make sure your folders have 755 permission. I cleared this issue with permission. This is first thing do any others. You can get successful output.
Thanks
If you are using a .htaccess on your site, it may be interfering with the web page you are trying to load into your browser. Please double check the .htaccess configuration. Any syntax errors will cause a 500 Internal Server Error message to be displayed instead of your website.
To confirm whether a misconfiguration .htaccess is the cause of the 500 Internal Server error, either remove or rename the .htaccess file temporarily and then try to reload the page
PHP Coding Timing Out
if your PHP script makes external network connections, the connections may time out. If too many connections are attempted and time out, this will cause a "500 Internal Server Error." To prevent these time outs and errors, you'll want to make sure that PHP scripts be coded with some timeout rules. Typically, however, catching a timeout error when connecting to a database or externally to remote resources (example: RSS feeds) are difficult. They, in effect, freeze the script from continuing to run.
Removing any external connections can increase both the performance of your website and decrease the chances of you receiving a "500 Internal Server Error."
This problem happen when the connection between client and server disconnected before complete the request.
I Solved this problem by increase the values of FastCGI configurations which located in file "/etc/httpd/conf.d/fcgid.conf" (In Apache 2.4, CentOS 7) to this values:
<IfModule mod_fcgid.c>
FcgidMaxRequestLen 10737418240
FcgidIOTimeout 36000
FcgidConnectTimeout 36000
FcgidBusyTimeout 36000
FcgidIdleTimeout 96000
FcgidProcessLifeTime 96000
</IfModule>

server X brings back 200 response, Server Y throws and Internal server error

I'm having an issue with a CURL reader I built (see: Premature end of script headers: php-cgi -- While running a CURL script)
The guy said to check if my problem server will speak to the feed, so I tested the below code locally and it works, tested in on the server and got an internal server error. I am lost here, how should I go about debug this as the host company are not being very helpful at all.
code:
$url = 'http://www.energydigger.com/feeds/headlines.xml';
list($status) = get_headers($url);
if (strpos($status, '200') !== FALSE) {
echo 'boom';
}
problem server response:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root#localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
all i am getting from the log they provide is:
[Wed Apr 24 20:36:01 2013] [warn] mod_fcgid: read data timeout in 60 seconds
[Wed Apr 24 20:36:01 2013] [error] [client 151.227.255.54] Premature end of script headers: php-cgi
Any advice is appreciated, as I'm a little stuck on what to do now.
Maybe I could reproduce it. But my environment uses mod_fcgid not simple cgi. Make sure the owner and group are the same as for the executing cgi user. Or for simplicity as all the other files in your webdirectory.

mod_fcgid errors, leading to 500 error page (full details included)

[Wed Dec 12 23:23:09 2012] [warn] [client 31.22.4.214] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Wed Dec 12 23:23:09 2012] [error] [client 31.22.4.214] Premature end of script headers: index.php
[Wed Dec 12 23:31:20 2012] [error] mod_fcgid: process /home/www-data/php5-fcgi(32763) exit(communication error), get unexpected signal 7
I get these errors every times in my APACHE logs. I am running a forum, and sometimes these errors get so severe, it returns a 500 error.
I am using APC, Debian OS, PHP5CGI, and MYSQL. Here is a list of the modules I am using on APACHE:
Link to image: i.stack.imgur(dot)com/bcrWn(dot)png
Could you please tell me what's wrong? Is this an APC issue?
I was getting the same random errors from three sites that were using APC extensively for both bytecode caching and other data using the W3 Total Cache plugin for Wordpress.
I disabled the APC caching on the sites, and the errors continued. Removing APC from the server, though, fixed it entirely. Since I researched this extensively and found almost no other incidences of "get unexpected signal 7" with PHP under mod_fcgid, I'm pretty confident that yes, your problem was probably caused by an APC issue.
I would imagine that you've already resolved your problem, since this question is over two months old, but hopefully this may help someone else who runs into the same error.
I was also seeing this error on a shared hosting environment using php-fcgi. APC is enabled but only being used on one site which wasn't generating the error.
It turned out the site with the error had exceeded their disk quota, something I discovered by accident when trying to update some files.
Increasing the disk quota for that site immediately resolved the issue.

Under load PHP communications with MySQL (seperate box) breaks

Our website today received an increase in users (about double our normal load) and our system has started to slow down. Our MySQL sits on it's own physical box, and we've started receiving these errors in our logs;
[Mon Jul 18 15:30:07 2011] [error] [client 2.221.255.55] PHP Warning: mysql_select_db() [<a href='function.mysql-select-db'>function.mysql-select-db</a>]: A link to the server could not be established in /home/livesite/_util.inc on line 301, referer:
The MySQL box is fine, and responds quite happily to our development server, but our live server, as of this load increase, is seeing this error message.
Does anybody know why PHP would just stop communication with MySQL on another box?
Your connection limit is likely too low. Usually you get a different error, but I wouldn't be surprised if this were the problem:
http://dev.mysql.com/doc/refman/5.5/en/too-many-connections.html
I suspect that line 301 is calling some function, such as mysql_real_escape_string(), which explains the error. There is probably a different error on connect, such as "too many connections", but that won't be in your logs if your connect line has an # in front of it.
Maybe you shuold look at your PHP INI file for mysqli.max_persistent and the like ?
Maybe your logic connects without disconnecting - fast enough ?

Categories