How to change upload_max_filesize on PHP 7.0 on Ubuntu 16.04

Ubuntu Tutorial – Hello everyone today I am going to show you how to change upload_max_filesize on PHP 7.0 installed on Ubuntu 16.04. If you are running WordPress CMS on Ubuntu 16.04, you will see maximum upload file size everytime we try to upload pictures or media files.

The default value of maximum upload file size is 2M (2 Megabytes). This value can be changed via PHP config. See how to do it below.

I am using the following system:

  • WordPress 4.7.4
  • Ubuntu 16.04.2
  • PHP version 7.0.15

To change maximum upload file size, we need to edit the php.ini file. If you are running PHP version 7.0, the php.ini is located underĀ /etc/php/7.0/apache2/ directory. Edit the file using nano:

sudo nano /etc/php/7.0/apache2/php.ini

Now find the following lines:

upload_max_filesize = 50M
post_max_size = 50M

Now close and save the file. Finally restart apache

sudo systemctl restart apache2

Now, open WordPress wp-admin again and you should see the maximum upload file size is changed to the new value.

Be the first to comment

Leave a Reply