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

May 28, 2014 49.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.
4 comments
  • 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 http://wptheming.com/2009/07/upload_max_filesize/

    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 123.234.123.234, the command would look like this: ssh root@123.234.123.234.

    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 :)

16 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

See: http://php.net/upload-max-filesize

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
/usr/local/vesta/php/lib/php.ini
/usr/local/vesta/src/rpm/conf/php.ini
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini
/etc/php5/cgi/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
To:
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
  • Well, I am having the same problem. I only have one file though and restarted and all... but no effect.
    In the file php.ini I have 512M, tried with less (128, 256, 10, 8, 16 etc) and nothing. Created a info.php file and there it says 2M...

  • How did you restart? Did you use the command

    sudo service apache2 restart
    
  • great info. helped me a lot.

https://drupal.org/node/97193 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 ?

Login to SSH

  1. open file /etc/php5/apache2/php.ini
  2. find uploadmaxfilesize = 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 base date 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.

Same problem here.

I tried to open file /etc/php5/apache2/php.ini but I got permission denied?

First if you dont find php.ini file create one and insert
uploadmaxfilesize=128M
postmaxsize=129M
maxexecutiontime=300 and save the file

Next specify the path of php.ini file inside .htaccess file using suPHPConfigPath/home/username/publichtml where username should be the username mentioned in cpanel. You can refer http://www.vinaypn.com/how-to-fix-maximum-upload-size-exceeded-error-in-wordpress-running-on-shared-hosting/

I have done it!

For increasing your file limit the easiest way is by loging into WHM and click on the Manu links at the left side called " Service configurations" Then click on "PHP Configuration Editor" then browse down to the line that has this: "Core ... uploadmaxfilesize ....The maximum size of an uploaded file." change the value from 2M to whatever you wanted, better keep to a minimum as per your requirement, I added mine to 6M and now I can upload up to 6MB.

Have fun!
Harib Shaqsy
haribshaqsy. com

Thank YOU geoff45e7908988 this is the solution I needed..

Have another answer? Share your knowledge.