Use the Quick Reference steps if you already know what you’re doing, and just need to copy the commands.
Prerequsites
- A server (local or remote) running LAMP with Ubuntu 14.04 or higher
- SSH access to your server
- Coffee
Steps
- Firstly you need to SSH into your server.
- You need to find out where you
php.ini
file is. Doing this via the commandline can be misleading (php --ini
only 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.cd
to your web servers root (probably/var/www/html
).- Run
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,
cd
to that path you just copied. - Open a file called
php.ini
in that directory. - Find where it says
upload_max_filesize =
and change the value to2048M
. - Still in the same file, find where it says
post_max_size =
and change the value to2048M
. - Save and exit the file.
- Run
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
vim /etc/php/7.0/apache2/php.ini
- Search for
upload_max_filesize
, change to required value. - Search for
post_max_size
, change to require value (=< thanupload_max_filesize
) sudo service apapche2 restart