Tech geek. Life geek.

Tag: timeout

php script timeout on php7.2-fpm and Nginx Webserver

Here is the background.

  • It is a php script that is accessed through a browser.
  • Server: Ubuntu 18.04
  • Web server: Nginx 1.14
  • php: php7.2-fpm


The script always stoped on 60 seconds.

The Nginx error log is shown below:

2019/10/23 14:05:18 [error] 996#996: *950 upstream timed out (110: Connection timed out) while reading response header from upstream, client:, server:, request: “GET /go/do-something.php HTTP/2.0”, upstream: “fastcgi://unix:/var/run/php/php7.2-fpm.sock”, host: “”

It is a timeout.  I knew it.

In the beginning, I am looking for the php timeout settings.

I tried to add max_execution_time to 360. It doesn’t help.

At last, I add a line into Nginx settings.

fastcgi_read_timeout 180;

Sample code below:

location ~ \.php$ {
    fastcgi_pass unix:/var/run/php7.2-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_read_timeout 180;
    include fastcgi_params;


ASP Limits

When I start to use Windows 2008 with IIS 7, I can not find the place to change time of script.
I have a ASP page which will go through whole database about 20MB, and retrieve the result and put into another database. Sometimes it takes about 3 minutes to finish.
I know how to change the IIS settings in IIS 5 and IIS 6. Now it is 7, I am lost.
Later I found the help page from Microsoft IIS site.
It describe the all limits settings of IIS 7.
The bufferingLimit attribute sets the maximum size of the ASP buffer. If response buffering is turned on, this attribute controls the maximum number of bytes that an ASP page can write to the response buffer before a flush occurs.
The maxRequestEntityAllowed attribute specifies the maximum number of bytes allowed in the entity body of an ASP request. If a Content-Length header is present and specifies an amount of data greater than the value of maxRequestEntityAllowed, IIS returns an HTTP 403 error response.
The processorThreadMax attribute specifies the maximum number of worker threads per processor that IIS may create.
Note: This setting can dramatically influence the scalability of your Web applications and the performance of your server in general. Because this attribute defines the maximum number of ASP requests that can execute simultaneously, this setting should remain at the default value unless your ASP applications are making extended calls to external components.
The queueConnectionTestTime attribute specifies the number of seconds that a request can be queued before ASP determines whether the client is still connected. If the request is queued longer than the number of seconds specified by the queueConnectionTestTime attribute, ASP checks to determine whether the client is still connected before executing the request. If the client is no longer connected, the request is not processed and is deleted from the queue.

Continue reading

© 2020 David Yin's Blog

Theme by Anders NorenUp ↑