Tutorials

How to increase PHP file upload limit with PHP FPM and Nginx

If while uploading a file you get an error with the following text in it :

"client intended to send too large body:"

You can fix this error by increasing the PHP File-Upload Limit as following :

Step 1: Open php.ini file

nano /etc/php5/fpm/php.ini

And update 'uploadmaxfilesize' and 'postmaxsize' values

upload_max_filesize = 150M
post_max_size = 150M

Step 2: Open Nginx conf file

nano /etc/nginx/nginx.conf

In the http block, add the following line :

http{
....
.....
....
client_max_body_size 150m;
client_body_timeout 120;
......

Then to bring the changes in effect restart Nginx and PHP-FPM

service nginx restart
service php5-fpm restart

Copyright © 2018 WPOven