php ini setting upload_max_filesize not working
Asked Answered
T

6

5

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.

Taverner answered 16/1, 2019 at 7:57 Comment(3)
can you try using 2G instead of 2048M ? just a try, but i don't think it's relevant.Insectivore
Anyway, look here: #37382022Insectivore
check post_max_size, upload_max_filesizeTunnel
T
6

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

sudo service php7.2-fpm restart
Taverner answered 16/1, 2019 at 10:8 Comment(1)
After struggling for 2weeks, finally this helped. Thank you so much man.Turves
S
3

You should also change in php.ini: post_max_size=2Gb

Shiprigged answered 16/1, 2019 at 8:16 Comment(0)
N
1

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 "

Nikkinikkie answered 16/1, 2019 at 8:9 Comment(0)
E
0

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 .

Erratum answered 14/12, 2019 at 8:35 Comment(0)
R
0

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 using sudo service apache2 restart. (This solution is tested on server with Ubuntu installed. )

Rowena answered 22/11, 2020 at 7:44 Comment(0)
R
0

After editing /etc/php/8.2/fpm/php.ini -> sudo service php8.2-fpm restart -> sudo service apache2 restart. Works for me.

Retorsion answered 14/3, 2023 at 4:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.