I'm running an Nginx + PHP-FPM server and I have a script that is supposed to execute over 30 minutes. After 240 seconds it ceases to function and returns a 502 Gateway error from Nginx.
PHP-FPM Log for the execution:
[03-May-2013 19:52:02] WARNING: [pool www] child 2949, script '/var/www/shell/import_db.php' (request: "GET /shell/import_db.php") execution timed out (239.971196 sec), terminating
[03-May-2013 19:52:02] WARNING: [pool www] child 2949 exited on signal 15 (SIGTERM) after 540.054237 seconds from start
[03-May-2013 19:52:02] NOTICE: [pool www] child 3049 started
Nginx log for the execution:
2013/05/03 19:52:02 [error] 2970#0: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 98.172.80.203, server: www.example.net, request: "GET /shell/import_db.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.example.net"
I've run this script on an apache+suphp server and it executes flawlessly. Nonethless, I am including:
set_time_limit(0);
at the top of my script.
The max_execution_time according to phpinfo()
is 1800 seconds (this was originally 300, I bumped it up to this in an attempt to get it working).
FastCGI Nginx Configuration:
## Fcgi Settings
include fastcgi_params;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180s;
fastcgi_read_timeout 600s;
fastcgi_buffer_size 4k;
fastcgi_buffers 512 4k;
fastcgi_busy_buffers_size 8k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors off;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
# nginx will buffer objects to disk that are too large for the buffers above
fastcgi_temp_path /tmpfs/nginx/tmp 1 2;
#fastcgi_keep_conn on; # NGINX 1.1.14
expires off; ## Do not cache dynamic content
I've restarted php-fpm and nginx to no avail. What setting or configuration am I missing from this or that I could check?