Increase max filesize for Wordpress files (one click installation)

Posted April 28, 2017 26.2k views
WordPressUbuntu 16.04

I want to upload a 50 MB File to my one click wordpress installation.

Wordpress cries that its too big a filesize.

Where are the configurations files I need to edit to set the filesize to mazbe a 100 MB?

  • You can directly make changes from the admin panel.This is the simple method i have used and help to solve most problems.

    1.Download and Activate WP File Manager Plugin
    2.Select .htaccess file you can change most of the commands.

    Some of the commands i used and solved my several issues. They are,

    phpvalue uploadmaxfilesize 64M
    value postmaxsize 64M
    phpvalue maxexecutiontime 300
    value maxinputtime 300

  • This completely broke my installation.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
8 answers


WordPress relies on your PHP configuration, so if PHP isn’t configured to allow uploads of that size, WordPress will throw an error.

You’ll want to modify your PHP’s php.ini file and change:




The defaults are 2MB and 8MB, so we can adjust those to something higher for your needs. I’d set them as:

upload_max_size = 64M


post_max_size = 96M

If you’re using NGINX instead of Apache, there’s a variable in NGINX’s main configuration file that you may also need to change as it also limits the size of uploads, that’d be:


You’d need to define that and set it to 64M as well.

client_max_body_size 64m;

You’d then restart Apache, or restart both NGINX and PHP-FPM. It just depends on which you’re using.

  • I know that. I want to know where php.ini is located in one click wordpress installation in digitalocean.

    • @Sternenfisch

      The issue isn’t that we, as a community, do no read or listen, it’s that in many cases, the OP is not 100% clear with all details, so we have to provide a best-guess type of answer.

      When we, as a community, make assumptions, in many cases, they are wrong. Given the trend – as well as popularity of WordPress, there are more one-click installers than I can count. They all do various things to the server, some of which modify directory structure.

      The default directories for most repositories will be:




      Where [version] is the version of PHP that was installed.

      That said, not all repositories use that structure, some place the release at the root, so it looks like:




      Again, with [version] being your PHP version. The above are different – the first applies to Apache while the other applies to PHP-FPM and in most cases, NGINX.

      That being said, I know that you mentioned one-click installer in your OP, though without a reference to whether you used the DigitalOcean one-click, a one-click for cPanel, a one-click for Plesk, etc – we’re just taking a guess.

      Some installers even use:




      You can also create a PHP info file using:

      <?php phpinfo()

      … name it info.php, access it from the web, and it’ll tell you everything about your PHP installation. You could also run php -i from the CLI to get the same but in a less-graphical format.

      I actually am a sysadmin, though without accessing a system directly, all I have to go on is your post and what you follow up with. From there, I’ll do my best to help :-).

      • I appreciate you doing the best you can to help.

        And I am fortunate to have come across this community function to ask questions mind you, while I feel digitalocean being the best suited webhost I have come across so far.

        As for the problem at hand, I have by now modified 4 php.ini I found in various directories in the droplet. None of them have actually been able to modify the upload file size limit.

        Which is what I expect.
        I have studied IT for several years before, and I am aware that it is a highly technical issue.
        What happens however, is that Brother Internet guides you to advice that is outdated, because it outdates really fast.

        So a guide on how to do this for Ubuntu 14.xx doesnt help me, cause now the droplet is ubuntu 16.04, uses a different php, which itself has changed its foldernames and directory structure.

        So I am mainly down to trial and error, and posting questions, hoping that someone actually goes through the process, makes it work and then gives me the steps.

        Cause if there is one thing I can do fast and efficient is to replicate working solutions.

        Figuring out it solutions myself (coding extensions etc) not so much. Just dont got the mental endurance to wrap my head around all the variables involved.

        But like said, I have looked into the structures I found. Now I look into those you mentioned.

        And hope someone comes along who in a scenario similar to mine made it work.

        And as for my comment, its good you are responsive.
        Thanks for that.


        • @Sternenfisch

          A sure fire way to see which ini file is being used is to create an info.php file and upload it to the web root (where your index.php file is).

          That file should contain:

          <?php phpinfo();

          Now access that using and the first block will tell you everything you need to know about the file(s) being used.

          You’ll want to look for:

          Configuration File (php.ini) Path

          Which tells you where the file is…and then:

          Loaded Configuration File

          Which tells you which configuration file is loaded and being used. Once changes are made, you need to restart Apache for the changes to take effect.

          service apache2 restart

          Delete info.php afterwards as you don’t want all that exposed to the public.

  • Also I noticed on an majority of my questions, those posting answers dont bother reading .

    Question was:

    Where are the configurations files

    What must I change.

    • People are just trying to help you out here mate, they don’t do this for living! If you keep being a dick like this they won’t help you anymore.

      The configuration files are at /etc/php/7.0/apache2

  • Hello @Sternenfisch,

    I’ve already changed uploadmaxsize and postmaxsize to 100M. But still still showing only 8M of upload in my WP panel.

    I’m using multisite network. And I’ve already changed the network settings to a size of 100M. But keep showing me 8M.

    Where do I find the clientmaxbody_size?

    I’ve located a “clientmaxbody_size” line in the /etc/nginx/nginx.conf file, is it the right location?
    There was already 50M. Even so, I’ve changed to 100M, but it keeps showing me 8M in WP admin.

    Cloudflare says the limit size is 100M

    And one detail … as I said above, I changed to 100M everywhere I could find. But in my panel it still shows me 8M and in my info.php shows me 50M. What madness is that?

    Where else can I change?



To help speed things up, I deployed Apache2 + PHP 7.0 on a fresh Droplet.

PHP’s php.ini file is located here /etc/php/7.0/apache2/php.ini. Depending on your PHP version, you may need to change that to 5.6 or 7.1.

When editing that file:

nano /etc/php/7.0/apache2/php.ini

And setting:

post_maxsize = 96M


upload_max_size = 64M

Then restarting Apache2:

service apache2 restart

The settings are showing as updated as they should be.

This can be confirmed by using:


$pms = ini_get('post_max_size');
$ums = ini_get('upload_max_filesize');

echo '<pre style="line-height: 2rem;">';
echo '<strong>post_max_size</strong>: ' . $pms;
echo '<br>';
echo '<strong>upload_max_size</strong>: ' . $ums;
echo '</pre>';
  • I just wanted to say that I had the same issue as OP and the information that everyone provided here was excellent. One thing that is frustrating is what value to change. @jtittle1 was great and I used ctrl+w to search for post_maxsize to change the value. Previously I had been searching “upload” and changing the wrong field:

    File Uploads ;

    ; Whether to allow HTTP file uploads.
    file_uploads = On

    ; Temporary directory for HTTP uploaded files (will use system default if not
    ; specified).
    ;uploadtmpdir =

    ; Maximum allowed size for uploaded files.
    uploadmaxfilesize = 40M

    Thank you for everyone that posted and if people are still having issues with this, make sure you are searching for the correct term!!

The configuration files are at /etc/php/7.0/apache2

Thanks @jtittle1 , pointing me at the nginx configuration parameters was important to me solving this!

One thing I learned, for others, was I had to increase the parameter in three separate sections, across three files. I added

client_max_body_size 200M;

to the http, location and server parts of my nginx.conf and the individual .conf files in sites-enabled (standard and ssl). whew.

All doesn’t seem to solve any problem.

Everything that is explained is fine, only if they did not solve it they are changing the number in the wrong place in php.ini, here is the correct line and my changes that did work, then restart Apache before seeing these changes reflected:

; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enablepostdatareading.
max_size = 512M

best, max-

How I solved my Problem of the 2M upload limit:

In Wordpress the Plugin “Increase Maximum Upload File Size” showed:
‘Maximum upload file size, set by your hosting provider: 2MB’ before the fix


'Maximum upload file size, set by your hosting provider: 100MB’ after the fix.

I figured out there are two “php.ini” files in the directory: /etc/php/7.3/
one under /cli and the other under /fpm.
Changing the php.ini under /cli didn’t solve it, but the php.ini the /fpm folder.

I also had to edit my nginx.conf file under /etc/nginx.
Add the following line to http or server or location context to increase the size limit in nginx.conf, enter:
“# set client body size to 64M #”
clientmaxbody_size 64M;

Afterwards in the console of my droplet I restartet the server using root access and the command: sudo shutdown -r now

This solved the problem. I hope it helps!

Kind regards


  • I figured out, the last step:

    I also had to edit my nginx.conf file under /etc/nginx.
    Add the following line to http or server or location context to increase the size limit in nginx.conf, enter:
    “# set client body size to 64M #”
    clientmaxbody_size 64M;

    is not necessary. Should work with just changing the

    uploadmaxsize = 64M


    postmaxsize = 96M

    in your php.ini.



You can create a php info file in order to check the current values and check which is the php.ini file in use. Create the following file in your public_hmtl folder - phpinfo.php and put the following code inside it:


You can also use the following command in order to find the location of the php.ini file:

php -i | grep php.ini

The output will be:

Configuration File (php.ini) Path => /etc/php/7.2/cli
Loaded Configuration File => /etc/php/7.2/cli/php.ini

Then check for the current value of uploadmaxfilesize you can also check which is the configuration file - php.ini that is currently used and apply the changes there (if the site using the global php.ini file and you change the values for these settings this will make the changes globally for all sites). Ideally you would like to have the following values:

upload_max_filesize = 64M

You also need to restart your web server in order the changes to take effect.

Hope that this helps!