Project

General

Profile

Support #651

Updated by Daniel Curtis over 8 years ago

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. 
 <pre> 
 vi /usr/local/etc/php.ini 
 </pre> 
 #* And #*And set: 
 <pre> 
 max_execution_time = 300 
 </pre> 

 * Edit the php-fpm config: 
 <pre> 
 vi /usr/local/etc/php-fpm.conf 
 </pre> 
 #* And set: 
 <pre> 
 request_terminate_timeout = 300 
 </pre> 
 *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: 
 <pre> 
 vi /usr/local/etc/nginx/conf.d/www.example.com.conf 
 </pre> 
 #* And add the @fastcgi_read_timeout 300@ statement: 
 <pre> 
 location ~ \.php$ { 
	 include /etc/nginx/fastcgi_params; 
         fastcgi_pass    unix:/var/run/php5-fpm.sock; 
	 fastcgi_read_timeout 300;  
 } 
 </pre> 

 * And restart nginx and php-fpm: 
 <pre> 
 service nginx restart 
 service php-fpm restart 
 </pre> 

 h2. Resources 

 * https://rtcamp.com/tutorials/php/increase-script-execution-time/

Back