Project

General

Profile

Support #651

Increase PHP Execution Time For Nginx

Added by Daniel Curtis over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Web Server
Target version:
Start date:
08/31/2015
Due date:
% Done:

100%

Estimated time:
0.50 h
Spent time:

Description

This is a guide on how to increase the PHP execution time for php-fpm on nginx.

  • Change max execution time limit in the main PHP config from the default 30 seconds to 300 seconds.
    vi /usr/local/etc/php.ini
    
    • And set:
      max_execution_time = 300
      
  • Edit the php-fpm config:
    vi /usr/local/etc/php-fpm.conf
    
    • And set:
      request_terminate_timeout = 300
      

      NOTE: If request_terminate_timeout is commented out, this value will be taken from the max_execution_time in the php.ini file.
  • To increase the time limit for www.example.com by:
    vi /usr/local/etc/nginx/conf.d/www.example.com.conf
    
    • And add the fastcgi_read_timeout 300 statement:
      location ~ \.php$ {
          include /etc/nginx/fastcgi_params;
              fastcgi_pass  unix:/var/run/php5-fpm.sock;
          fastcgi_read_timeout 300; 
      }
      
  • And restart nginx and php-fpm:
    service nginx restart
    service php-fpm restart
    

Resources

Also available in: Atom PDF