Increase Maximum File Upload Size in WordPress on DigitalOcean

Today while I am migrating my ProDomainBlog from Justhost shared hosting to Digital Ocean VPS hosting I had couple of problems one big among them is “The uploaded file exceeds the upload_max_filesize directive in php.ini” message.

I got this error message while I am installing my WordPress theme (Splash from MyThemeshop), I know one thing, that is there is no problem with the theme because installed it couple of days back at my Niche domain Best Motorcycle Gloves. So what is the problem at my new host why I am getting following message?

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

I tried couple of things but nothing worked out and finally I found out the answer for this and sharing the same thing step by step here.

  1. Connect to your Digital Ocean Droplet using SSH command from your terminal window ( Check your digital ocean email for how to connect details and password)
  2. After login type following command in your terminal window:
    sudo nano /etc/php5/apache2/php.ini
  3. Now look for “upload_max_filesize = 2M” text and replace it with following lines of code
    upload_max_filesize = 64M
    post_max_size = 64M
    max_execution_time = 300
  4. Restart your Apache 2 server using following command
    sudo service apache2 restart

If 64M is not working than try 10MB.

That’s it. Now upload your theme. It will work without any problem.

Note: This worked for me, I am using Ubuntu WordPress application image as my Droplet at DigitalOcean. You can try this at other hosts but I didn’t tried it anywhere else.

  • Nice Tutorial Its Working For Me Also now i can Upload Large File after use this methode

    Thank you

    • RajVasireddy

      Thanks, am able to help you.

      • Guest

        I am getting this screen. Plz help what can I do to fix this issue.

        • RajVasireddy

          Go down in the screen. look for this line “upload_max_filesize = 2M” and then change it to upload_max_filesize = 64M

          and also add following lines

          post_max_size = 64M
          max_execution_time = 300 then restart apache 2 server

      • I am getting this screen, Plz guide me further what should I do to fix this issue?

  • Great tip! Works very reliably. Thank you!

  • Greg

    Thanks a lot for posting! Worked perfectly!

  • Juliet Starling

    thanks so much! bookmarked

  • Thank you so much ^^

  • Gotlieb Nakuumba

    Thanks much, that worked for me compared to many other posts on the internet. I am currently trying to gain rights to my upload folder. If you have an idea on this, please help:


    Unable to create directory wp-content/uploads/2015/07. Is its parent directory writable by the server?

  • Perfect thanks