php.ini upload_max_filesize is not working

Posted May 9, 2019 11.2k views
ApachePHPUbuntu 18.04


I have updated uploadmaxfilesize in php.ini (which is in the php_info()) and restarted the apache with

sudo service apache2 restart

But phpinfo() still showing uploadmaxfilesize as 2M. I even tried to restart the server but the same result. I changed the postmax_size but it is showing as 8M.

Can someone give solution to this?

1 comment
  • I have edited my php.ini file located in /etc/php/7.0/apache2/php.ini
    I have changed the “uploadmaxfilesize” value from 16mb to 32mb
    I restarted the server, and as a result, my php max upload filesize was updated.
    This was evident because i created a php info file in my /var/www/html and the changes reflected in in phpinfo.

    Did you edit the php.ini file in the right place? You have not specified any information regarding your setup. Wordpress may require changes to htaccess to increase upload size but you haven’t specified.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

You are changing in the wrong place inside php.ini, you must search and change the following, then restart apache.

; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enablepostdatareading.
max_size = 512M

best, max.



You can create a php info file in order to check the current values and check which is the php.ini file in use. Create the following file in your public_hmtl folder - phpinfo.php and put the following code inside it:


You can also use the following command in order to find the location of the php.ini file:

php -i | grep php.ini

The output will be:

Configuration File (php.ini) Path => /etc/php/7.2/cli
Loaded Configuration File => /etc/php/7.2/cli/php.ini

Then check for the current value of uploadmaxfilesize you can also check which is the configuration file - php.ini that is currently used and apply the changes there (if the site using the global php.ini file and you change the values for these settings this will make the changes globally for all sites). Ideally you would like to have the following values:

upload_max_filesize = 64M

You also need to restart your web server in order the changes to take effect.

Hope that this helps!