The uploaded file exceeds the upload_max_filesize directive in php.ini.

Posted November 1, 2014 22.1k views

Trying to add a theme that I downloaded for Wordpress but when I try to upload it, it states the following:

The uploaded file exceeds the uploadmaxfilesize directive in php.ini.

How do I fix this?

  • Can anyone give step by step instruction for solving this problem.

    i m using Wordpress on Ubuntu.

    and i don’t know how to access the php.ini file on Digital ocean

  • Here’s how you’d do it on Ubuntu with Nginx & PHP5:

    sudo nano /etc/php5/fpm/php.ini

    Update this setting values to your liking

    post_max_size  16M
    upload_max_filesize  16M

    Save the file: Ctrl + O hit Enter, then Ctrl + X to quit the file editing.
    Then perform a restart of the PHP5-FPM service

    sudo service php5-fpm restart

    For the sake of just being sure (it wouldn’t harm no kittens), perform a nginx restart as well:

    sudo service nginx restart

    That should do it. I hope. :-)

  • I’m a complete noob to almost everything regarding consoles and server management, especially SSH, so I struggled with this one for a while.

    After figuring out some basics in ssh, such as using the ls command to list directories, I noticed that the php.ini file on my server is located here, rather than the above mentioned directory:


    I stumbled a bit to figure out what the correct service to restart is, but I think this did it:

    sudo service apache2 restart

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
3 answers

I bumped into exactly the same problem few days ago. The solution I found was adding the following lines to php.ini in the root directory of the Wordpress install.

post_max_size = 16M
upload_max_filesize = 16M
memory_limit = 128M

However, the system didn’t seem to honor the settings. Instead, editing /etc/php5/fpm/php.ini solved this problem for me.

You might have different versions of php.ini files in your installation. To check which one you should be altering its uploadmaxfilesize line, use:

php -i | grep "Loaded Configuration File"

Then do a

sudo service nginx restart

By increasing upload_max_filesize in your php.ini.