Support » Fixing WordPress » Upload limit stuck at 2MB

  • Resolved nathank1989

    (@nathank1989)


    1. Upload limit is stuck at 2MB
    2. my PHP.ini file has upload_max_filesize = 1024M
    3. I’m running WP-Multisite, and the default is 1024000KB
    4. The specific site I also edited to set 1024MB
    5. In WP-Config I have set: define( 'WP_MEMORY_LIMIT', '512M' );
    define( 'WP_MAX_MEMORY_LIMIT', '1024M' );
    6. in my theme functions.php I have added: @ini_set( 'upload_max_size' , '1024M' );
    @ini_set( 'post_max_size', '1024M');
    @ini_set( 'max_execution_time', '300' );
    7. Not shared hosting. Running standard VPS with CentOS.

    All of these do not work. It displays the limit is 2MB and sternly will not let me upload anything more. This is frustrating.

Viewing 15 replies - 1 through 15 (of 17 total)
  • Are you using Shared Hosting? Who is our host?
    Some hosts disable tye php.ini configuration for individual sites on shared servers so editing it won’t make a difference if it is tye case. Try contacting your host. They’ll be able to assist you better.

    No. I’m running my own VPS

    If you’re running your own VPS, would it be any more effective to simply adjust upload_max_filesize = 2M (and) post_max_size = 8M from the global php.ini file?

    My global php.ini is as follows:
    (PHP Version 5.6)
    max_execution_time = 30
    max_input_time = 60
    max_input_vars = 1000
    memory_limit = 512M
    session.save_path = ""
    upload_max_filesize = 1024M

    It doesn’t make sense, if the php.ini, wp-config.php, funtions.php and .htaccess are all edited to allow for a 1024M limit, why doesn’t it work? Other sites on my VPS are enabled just fine. For some reason it’s just this one install of WP that isn’t working for me….

    Other sites on my VPS are enabled just fine. For some reason it’s just this one install of WP that isn’t working for me….

    What does phpinfo() report for upload_max_filesize?

    When you edited the global php.ini file, did you remember to restart httpd afterwards?

    Some notes about post_max_size and its potential for effect on uploads.

    http://php.net/manual/en/ini.core.php#ini.post-max-size

    http://ssdcougars.tv/myphpinfo.php
    This is a temporary link to my phpinfo()

    upload_max_filesize 1024M 1024M

    in my theme functions.php I have added: @ini_set( ‘upload_max_size’ , ‘1024M’ );
    @ini_set( ‘post_max_size’, ‘1024M’);
    @ini_set( ‘max_execution_time’, ‘300’ );

    I’m not sure any of that is doing anything for you.

    Your max_execution_time is still at 30, and post_max_size is at 8M. I think the only reason upload_max_filesize is 1024M is probably because you changed it in your global php.ini config.

    With upload_max_filesize at 1024M and post_max_size still at 8M, I think I might expect WordPress to report a maximum upload size of 8M at the bottom of the media uploader dialog in the dashboard (rather than the default of 2M). Just to make sure we’re on the same page, can you confirm that it actually still says “Maximum upload file size: 2 MB.” instead of “8MB” at the bottom of the dialog box at Dashboard > Media > Add New?

    2MB limit.

    I’m going to manually try to reedit my ini file and restart Apache.
    I’m using the latest version of cPanel with EasyApache4 and noticed that my upload limit “broke” after my easyApache upgrade. When I first installed it, it worked with a recognized limit of 1GB (1024M)
    With EasyApache4 and cPanel you get Multi-INI php so you can basically run different versions of PHP on the same server, but I double checked and ALL of my sites are on 5.6, and inherited their version from the primary settings in WHM.

    I also used cPanel’s MultiINI editor to edit my PHP.ini file and its “wizard” didn’t have post_max_size, otherwise I definitely would not have set that to 8M

    Nope, didn’t work. I even updated my ini to change the post_max_size and still reading 2M.

    Ok, so after digging further and getting a response back from my hosting provider, there was another global php.ini file that was overriding everything else that I was unaware of.

    While the loaded conf file was an ini in my www directory, there was another configuration path in /opt/cpanel/ea-php56/root/etc/php.ini

    That one was untouched with all the limits set to defaults.

    Now something else weird happened. After I set the limit to 1024M and WordPress reported 49M.

    So honesty, I just said Fudge this Stuff! (Only I didn’t say fudge) and set it to ‘0’ to disable the POST limit all together and once I did that, WordPress reads
    “Maximum Upload Size: .”
    And uploads files without issue until my timeout limit, which I kept at 360s.

    I just said Fudge this Stuff! (Only I didn’t say fudge) and set it to ‘0’ to disable the POST limit all together and once I did that, WordPress reads
    “Maximum Upload Size: .”

    Did you get a chance to read any of this? http://php.net/manual/en/ini.core.php#ini.post-max-size

    ” post_max_size integer
    Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. Generally speaking, memory_limit should be larger than post_max_size”

    Yea I did, and while that is good practice, it didn’t quite work for me. Anything I set just kept WordPress at reporting 49MB, now that I disabled the POST limit and properly set the memory limit and file size everything works as expected.
    I just wish I can set the max post size to 1GB, but like I said, for some reason WordPress hits a roof at 49M.

    For all intents and purposes my problem is solved.
    (Marking as such)

    In my case, I had to remember to restart PHP-fpm as well – as below, for example, if you have Ubuntu 16:

    sudo service php7.0-fpm restart

    I have PHP 7 – with PHP 5, your fpm service is probably php5-fpm

    Also, if you are running Nginx, you have to allow nginx to accept larger POST sizes. The default appears to be less than 27MB, at any rate.

    See http://stackoverflow.com/questions/2056124/nginx-client-max-body-size-has-no-effect

    The solution is to add client_max_body_size 30m; or something similar to a server directive in your conf files.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Upload limit stuck at 2MB’ is closed to new replies.