{ Find your php.ini }

If you’re working on a LAMP stack, with or without nginx, you’ll often need to make some changes to PHP config. A very popular scenario is an unsatisfactory max upload size, which can default to as low as 8MB.

There is also a php.ini for command line actions, so if you’re looking to update the one for your front-facing website / CMS, you’ll need to find the right one.

The simplest way is to create an arbitrary PHP file and make use of phpinfo:

info.php
<?php phpinfo();

Visit this page in your browser and you’ll see something like the below.

phpinfo

What you’re looking for is “Loaded Configuration File”. Now you can SSH in and modify it as much as you want.

You’ll want to update “upload_max_filesize”, and because you’re most likely going to be POSTing the file, “post_max_size” should have the same value.

Save and restart your server or appropriate service for the changes to take effect. In my case, I need to restart php7.1-fpm. Refresh the file you created with phpinfo() in your browser and make sure the values you changed are reflected there.