Article ID: 128083, created on Jan 18, 2016, last review on Jan 18, 2016

  • Applies to:
  • Operations Automation

Symptoms

Customer is trying to open the website located on NG hosting, but the following error is shown in browser:

Gateway Time-out
The gateway did not receive a timely response from the upstream server or application.

The following error is shown in the webspace log:

Script timed out before returning headers: php-cgi

Cause

Case 1: the default timeout for CGI scripts is 120 seconds, and Apache closes the connection if the script remains silent all that time, killing the nested php-cgi process.

Case 2: NFS share did not release lock.

Resolution

Case 1:

  1. You need to increase the ScriptTTL value to e.g 1200 in the /etc/httpd/conf.d/modsucgid.conf file on each NG Hosting web server.

    [root@webNG01 ~]# grep ScriptTTL /etc/httpd/conf.d/modsucgid.conf
    #  ScriptTTL - number of seconds after which script will be killed
    ScriptTTL 1200
    
  2. Restart the Apache service to make the changes effective.

Case 2:

  1. Stop NFS service:

    /etc/init.d/nfslock stop
    
  2. Kill the pending tasks of nfsshare.

  3. Start NFS service:

    /etc/init.d/nfslock start
    
  4. Configure nfs lockd ports and make sure that it is listening properly:

    [root@ngnfs ~]# grep -i lock /etc/sysconfig/nfs
    LOCKD_TCPPORT=10300
    LOCKD_UDPPORT=10301
    

Search Words

Script timed out before returning headers: php-cgi

ScriptTTL

SIGTERM

504 Gateway Time-out Script timed out before returning headers: php-cgi

Script timed out before returning headers

Gateway Time-out

5356b422f65bdad1c3e9edca5d74a1ae caea8340e2d186a540518d08602aa065 e12cea1d47a3125d335d68e6d4e15e07

Email subscription for changes to this article
Save as PDF