How I can fix this issue "The uploaded file exceeds the upload_max_filesize directive in php.ini"

Posted May 28, 2014 111.7k views
Plz anyone can help me on how to fix this issue on WordPress "The uploaded file exceeds the upload_max_filesize directive in php.ini". Whenever I install a theme, I get this error.
  • I think you need to edit the php.ini file
    and change the default value you need to find the pathof the file and nano it or vi as a su
    here’s a link that may help you

    in my case I am using WHM and I am able to edit the php settingsfrom within the WHM control panel.

  • Login to SSH

    1. open file /etc/php5/apache2/php.ini
    2. find upload_max_filesize = 2M (default is set to 2MB)
    3. Change 2M to 16M
    4. Save (press control O to write out)
    5. exit (press control x to exit)
    6. restart Apache by using command (sudo service apache2 restart) Done!

    Try uploading again :)

  • This option is for the date base of upload in PHPMyAdmin, but I want to know how to increase the upload of Media in WordPress (php.ini the wp-admin folder) because I have not found. Uploading default WordPress is 20M. Can anyone help? Thank you.

  • Connect to your root via the following:
    For example, if the server IP address was, the command would look like this: ssh root@

    Enter your password and hit enter.
    Paste the following command. vim /etc/php5/apache2/php.ini
    Then hit enter.
    Type /uploadmaxfilesize
    Then hit enter.
    Use your cursor to hover over the 2M and change 16M. You can use the delete button to remove additional characters if you make a mistake.
    exit (press control x to exit)
    restart Apache by using command (sudo service apache2 restart) Done!
    Try uploading again :)

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
17 answers
Right, you need to edit the file /etc/php5/apache2/php.ini and increase the setting for upload_max_filesize By default, it is only 2MB


If you restart apache after making the change:
sudo service apache2 restart

It takes affect right away!

Find all php.ini files:
root@server:~# find / -name php.ini

Edit the files:
root@server:~# nano /usr/local/vesta/php/lib/php.ini

Use crtl + w for search for upload

Change this line:
uploadmaxfilesize = 2M
uploadmaxfilesize = 10M

Repeat for all files:

root@server:~# nano /usr/local/vesta/src/rpm/conf/php.ini
root@server:~# nano /etc/php5/apache2/php.ini (this is probably the one you should change)
root@server:~# nano /etc/php5/cli/php.ini
root@server:~# nano /etc/php5/cgi/php.ini

Restart apache:
root@server:~# sudo service apache2 restart

  • Restarting web server apache2 explains how to increase the max upload file size, php.ini should be somewhere around /etc/php5
@andrewSB i have tried this, but still no joy. I also restarted the server :/
@grantbajere: Could you provide some more details? What OS are you running, Ubuntu? Are you using the DigitalOcean one-click Wordpress app, or did you install it yourself?
@andrewSB : Thanks for the help.
I am running ubuntu, and set it all up myself. I added a plugin to WordPress, and it shows the current limit being pulled through from the ini file. This IS correct, so my ini update is fine, but the actual Wordpress page rejects the file. So it seems that i have done this correctly, but WordPress is set to 1MB still. No idea how to fix it though. Any ideas?
@grantbajere: When you say that it "rejects the file," does it give the exact same error as the original poster? If not, what does it say?
@andrewSB: odd... woke up this morning and tried an upload to show you the error message, but its working now. Maybe it takes a few hours to propagate through the DigitalOcean servers? Is it a cache thing? Iv not set it up...

We have installed using once click wordpress on ubuntu.

Our upload size has been restricted to 8M .

how should we go about increasing it ?

Previous 1 2 Next