PHP FastCGI hangs

Just as a self reminder, this blog post explains why php-cgi might hang/stop silently when your load increases, and how to fix it, where it explains (in short) that fast-cgi should have the parameter PHP_FCGI_MAX_REQUESTS should equal 1000 or more (this can be done in /etc/default/php-fastcgi on my Ubuntu server).

 

Also worth a look is this page which has nothing to do with fast-cgi but describes how to increase the timeout in nginx when there is a proxy: http://blogs.agilefaqs.com/2011/07/21/upstream-connection-timed-out-error-in-nginx/ (that is if you get the timed-out connection error and do not find the setting above in the first place). In short:

server {
    listen       80;
    server_name  my.website.com;
    server_name_in_redirect off;
    port_in_redirect        off;

    location / {
        proxy_set_header  X-Real-IP  $remote_addr;
        proxy_set_header  X-Real-Host  $host;
        proxy_read_timeout 120;
        ...
    }
    ...
}
It's only fair to share...Share on Facebook
Facebook
Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin
Share on Tumblr
Tumblr
Email this to someone
email

Leave a Reply

Your email address will not be published. Required fields are marked *