Discover Centmin Mod today
Register Now

PHP-FPM How do I increase the file upload size?

Discussion in 'Centmin Mod Insights' started by Abbas Jaffar Ali, Aug 30, 2014.

  1. Abbas Jaffar Ali

    Abbas Jaffar Ali New Member

    13
    4
    3
    Jun 18, 2014
    Ratings:
    +4
    Local Time:
    11:45 PM
    I remember asking this before and getting an answer but can't seem to locate where I did that. Where and dow do I increase the file upload size for php?

     
  2. rdan

    rdan Well-Known Member

    5,439
    1,398
    113
    May 25, 2014
    Ratings:
    +2,187
    Local Time:
    4:45 AM
    Mainline
    10.2
  3. eva2000

    eva2000 Administrator Staff Member

    53,488
    12,130
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,671
    Local Time:
    6:45 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    For PHP, 2 values in php.ini are

    Code:
    php -i | egrep '^upload_max_filesize|post_max_size'
    
    post_max_size => 15M => 15M
    upload_max_filesize => 15M => 15M
    you can either edit php.ini which may reset on PHP upgrades, or create custom.ini file as outlined at PHP-FPM - Transfer all my custom changes from php.info to php-fpm config | Centmin Mod Community and place the custom values in custom.ini

    i.e. /etc/centminmod/php.d/custom.ini
    Code:
    post_max_size=20M
    upload_max_filesize=20M
    Then restart PHP-FPM

    For Nginx what @RoldanLT stated :)
     
  4. Abbas Jaffar Ali

    Abbas Jaffar Ali New Member

    13
    4
    3
    Jun 18, 2014
    Ratings:
    +4
    Local Time:
    11:45 PM
    Thank you both
     
  5. Matt Williams

    Matt Williams WordPress Fanatic

    537
    104
    43
    Nov 22, 2014
    Virginia, USA
    Ratings:
    +157
    Local Time:
    4:45 PM
    latest
    10
    I have changed all 3 values to equal the same

    Code:
    post_max_size = 100M
    upload_max_filesize = 100M
    client_max_body_size = 100M

    and restarted nprestart and even rebooted the VPS and the values have still yet to change displayed in php.ini
    Any suggestions here?

    PHP 5.4.40 | Centmin Beta02
     
  6. eva2000

    eva2000 Administrator Staff Member

    53,488
    12,130
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,671
    Local Time:
    6:45 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    .08 beta has a new custom file at /etc/centminmod/php.d/a_customphp.ini and add the change to that to override php.ini :)
     
  7. Matt Williams

    Matt Williams WordPress Fanatic

    537
    104
    43
    Nov 22, 2014
    Virginia, USA
    Ratings:
    +157
    Local Time:
    4:45 PM
    latest
    10
    Thanks George!
     
  8. Andy

    Andy Active Member

    540
    89
    28
    Aug 6, 2014
    Ratings:
    +132
    Local Time:
    3:45 PM
    I tried to upload a 72MB video using XFMG and got this error
    client intended to send too large body: 72825747 bytes,

    I check my /etc/centminmod/php.d/a_customphp.ini and the content is
    Code:
    date.timezone = Australia/Brisbane
    max_execution_time = 60
    short_open_tag = On
    realpath_cache_size = 6144k
    realpath_cache_ttl = 86400
    upload_max_filesize = 800M
    client_max_body_size =800M
    memory_limit = 800M
    post_max_size = 800M
    expose_php = Off
    mail.add_x_header = Off
    max_input_nesting_level = 128
    max_input_vars = 10000
    mysqlnd.net_cmd_buffer_size = 16384
    always_populate_raw_post_data=-1
    I have no problem uploading video files of 40MB but with a large size allowed, any clue on why the 72mb file failed?
     
  9. eva2000

    eva2000 Administrator Staff Member

    53,488
    12,130
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,671
    Local Time:
    6:45 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    should be /usr/local/nginx/conf/nginx.conf setting
    Code:
    client_max_body_size 10m;
    for my forums i have 10mb max size
     
  10. Andy

    Andy Active Member

    540
    89
    28
    Aug 6, 2014
    Ratings:
    +132
    Local Time:
    3:45 PM
    Great. I had 50MB limit there. I thought the setting in custom.ini will overwrite it?
    Thanks George
     
  11. eva2000

    eva2000 Administrator Staff Member

    53,488
    12,130
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,671
    Local Time:
    6:45 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    that custom.ini is php setting, nginx.conf is nginx level - so different areas :)
     
  12. Andy

    Andy Active Member

    540
    89
    28
    Aug 6, 2014
    Ratings:
    +132
    Local Time:
    3:45 PM
    I must have misunderstood things. I see a few posts above suggesting making the changes about upload file size to the custom.ini and it uses the same client_max_body_size variable.
     
  13. eva2000

    eva2000 Administrator Staff Member

    53,488
    12,130
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,671
    Local Time:
    6:45 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Now ya know :)