Increase PHP-FPM's max upload file size

15,098

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.

Share:
15,098

Related videos on Youtube

Suvitruf - Andrei Apanasik
Author by

Suvitruf - Andrei Apanasik

Updated on September 18, 2022

Comments

  • Suvitruf - Andrei Apanasik
    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
    Suvitruf - Andrei Apanasik almost 7 years
    This changes in pool configuration file didn't help .
  • Suvitruf - Andrei Apanasik
    Suvitruf - Andrei Apanasik almost 7 years
    Looks like client_max_body_size 0; in the server section of nginx config did the trick. Thanks.
  • Tero Kilkanen
    Tero Kilkanen almost 7 years
    Did you restart PHP-FPM after changes?
  • Suvitruf - Andrei Apanasik
    Suvitruf - Andrei Apanasik almost 7 years
    Yep, I've restarted fpm and nginx.