Apache File Upload and Max Upload Size

If you’re like me and you always try to do things yourself, then you have probably tried hosting a website yourself: whether it was for your personal use or otherwise.

And like me, you probably have some sort of database driven website and needed to upload a database only to get an error: file not uplaoded. And the cause of this error, this time let’s assume it was due to the file upload size in PhpMyAdmin (there can be other reasons for this error). So you’re in a bind, your database file is larger than your server will allow. What to do???

The answer, increase the file upload size. It’s really simple to do, providing that you have access to the Apache conf file. I’m also going to assume (and we all know what happens when you assume) that you have installed Ubuntu 14.04 as your web server. Follow these steps to increase your file upload size:

  1. Assuming you have not made any changes to Apache as yet
  2. Open “sudo nano /etc/php5/apache2/php.ini”
  3. Search for “upload_max_filesize” using “CTRL + W” and the value from “2M” to “128M” (or whatever file size you want)
  4. Search for “post_max_size” and change its value to the same value that you set above
  5. Save the changes by pressing “CTRL + O”
  6. Exit the editor by pressing “CTRL + X”
  7. Finally, restart Apache by using “sudo service apache2 restart” and you should be able to upload your large database file

I hope this helps you guys out there in cyber space. So until next time, ttfn ta ta for now.

Tags: ,