So, for some reason PHP’s default upload size is only 2MB. This might have been large enough for most files way back in the day, but these days it’s barely enough to move a .doc file around. Here’s how to change it to whatever you like.
Use the Quick Reference steps if you already know what you’re doing, and just need to copy the commands.
- A server (local or remote) running LAMP with Ubuntu 14.04 or higher
- SSH access to your server
- Firstly you need to SSH into your server.
- You need to find out where you
php.inifile is. Doing this via the commandline can be misleading (
php --inionly shows you which php.ini file is being used by the command line interface), so we’re going use your servers web server to tell us.
cdto your web servers root (probably
echo "<?php phpinfo(); ?>" > info.php
- Open your web browers and go to http://YOUR_SERVER_ADDRESS/info.php, obviously inputting your servers address in the url.
- You should see a page with your php details. Look for where it says Configuration File (php.ini Path). It should be on the fourth row from the top. Copy that path.
- Back in your server,
cdto that path you just copied.
- Open a file called
php.iniin that directory.
- Find where it says
upload_max_filesize =and change the value to
- Still in the same file, find where it says
post_max_size =and change the value to
- Save and exit the file.
sudo service apache2 restart.
- Exit your server.
- That’s it, you’re done.
You should now be able to upload files of up to 2GB into your server.
Quick Reference Steps
- Search for
upload_max_filesize, change to required value.
- Search for
post_max_size, change to require value (=< than
sudo service apapche2 restart