Step 1st:
1 |
sudo apt-get update |
Configure php.ini file
Once the installation is completed you need to edit the php.ini file. Find the configuration file:
1 2 |
php --ini |grep Loaded Loaded Configuration File: /etc/php/7.1/cli/php.ini |
Edit the file using your favorite text editor:
1 |
sudo nano /etc/php/7.1/cli/php.ini |
Make the following changes:
1 2 |
cgi.fix_pathinfo=0 max_execution_time = 300 |
Increase PHP script execution time with Nginx
Step #1:
Changes in php.ini
If you want to change max execution time limit for php scripts from 30 seconds (default) to 300 seconds.
1 2 3 |
vim /etc/php7.0/fpm/php.ini Set… max_execution_time = 300 |
Changes in PHP-FPM
Takes value ofmax_execution_time found in php.ini
Edit…
1 2 3 4 5 |
vim /etc/php5/fpm/pool.d/www.conf or sudo nano /etc/php7.0/fpm/pool.d/www.conf Set… request_terminate_timeout = 300 |
Then
Changes in Nginx Config File
Increase the execute time limit for local.lv.com ( Virtual Host ) by bellow code
1 2 3 |
vim /etc/nginx/sites-available/local.lv.com or sudo nano /etc/nginx/sites-available/local.lv.com |
Put fastcgi_read_timeout 300;
1 2 3 4 5 |
location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_read_timeout 300; } |
If you want to increase time-limit for all-sites on your server, you can edit main nginx.conf file:
1 2 3 4 5 6 7 8 |
vim /etc/nginx/nginx.conf ore sudo nano /etc/nginx/nginx.conf http { …………………... fastcgi_read_timeout 300; ……………. } |
Finally Restart your server
Reload PHP-FPM & Nginx
Don’t forget to do this so that changes you have made will come into effect:
1 2 |
service php7.0-fpm reload service nginx reload |