I need to change upload limit to 2GB on php 7.2 Ubuntu 16.04.
As a first step, when I check /etc/php/7.2
folder I can see cli
and
fpm
folders.
So to make sure the ini location I have print the php info using
echo phpinfo()
And I got the output
Server API : FPM/FastCGI
Virtual Directory Support : disabled
Configuration File (php.ini) Path : /etc/php/7.2/fpm
Loaded Configuration File : /etc/php/7.2/fpm/php.ini
And I have edited /etc/php/7.2/fpm/php.ini
with
upload_max_filesize = 2048M
And restarted the apache but using phpinfo() still it print
upload_max_filesize 2M
So I have tried with command php -i | grep -i "loaded configuration file"
but it print different configuration file,
Loaded Configuration File => /etc/php/7.2/cli/php.ini
On this file also I have changed upload_max_filesize to 2048 and restarted the Apache and still the result is same.
What could be the problem, any help will appreciated.
6
Answers
I got the problem resolved by the answer here Changes to upload_max_filesize in Ubuntu php.ini will not take effect.
Instead of restarting the apache I have to restart the php using
first at all you should remove all older php version on your ubuntu.
what is your cli php version?
are you sure that you find correctly php.ini location?
please run this command ” locate php.ini “
You should also change in php.ini:
post_max_size=2Gb
Sometimes due to error in php.ini files the configuration files are not loaded after that specific error line. In that case you have to thoroughly check the php.ini file and fix the errors.
Alternatively you can download fresh php.ini files for your php version and replace your existing file with the new one.
After making changes in the new file restart your server using
service apache2 restart
.If changing
/etc/php/7.2/fpm/php.ini
and/etc/php/7.2/cli/php.ini
still does not work out, try changing/etc/php/7.2/apache2/php.ini
. Please note that you might have to restart the apache2 server usingsudo service apache2 restart
. (This solution is tested on server with Ubuntu installed. )After editing /etc/php/8.2/fpm/php.ini -> sudo service php8.2-fpm restart -> sudo service apache2 restart. Works for me.