Increase PHP-FPM's max upload file size
Solution 1
nginx
have its own option called client_max_body_size
that can be defined for http
, server
and location
context. Check whether that options is set to non-zero value or not. You can set it to zero to disable body size checkout and then only PHP settings become actual.
Solution 2
You need to check the active .ini settings via PHP's phpinfo()
function from a script that you are executing via PHP-FPM. Running php --ini
shows settings that apply to the command line PHP, which might be different from PHP-FPM.
To change PHP-FPM php.ini values, you need to edit the pool configuration file, and add
php_admin_value[post_max_size] = 12M
php_admin_value[upload_max_filesize] = 10M
These will change the INI settings applied to the PHP-FPM pool you are running.
Alternatively you can look up the php.ini
file for your PHP-FPM setup and change the setting over there.
Related videos on Youtube
Comments
-
Suvitruf - Andrei Apanasik over 1 year
I've increased params values in php.ini:
upload_max_filesize = 10M post_max_size = 12M
And
php --ini
command in console shows me:post_max_size => 12M => 12M upload_max_filesize => 10M => 10M
But anyways, when I'm trying to send file > 1mb I get err. In nginx logs I see:
2017/06/03 12:06:40 [error] 16254#16254: *7 client intended to send too large body: 1778665 bytes
fastcgi_param PHP_VALUE "upload_max_filesize = 10M \n post_max_size=12M"
in nginx conf doesn't help too.So, how can I increase max upload file size?
-
Suvitruf - Andrei Apanasik almost 7 yearsThis changes in pool configuration file didn't help .
-
Suvitruf - Andrei Apanasik almost 7 yearsLooks like
client_max_body_size 0;
in theserver
section of nginx config did the trick. Thanks. -
Tero Kilkanen almost 7 yearsDid you restart PHP-FPM after changes?
-
Suvitruf - Andrei Apanasik almost 7 yearsYep, I've restarted fpm and nginx.