3

I have changed php.ini's some value in php.ini file and also through php script like,

ini_set('upload_max_filesize', '10M');
ini_set('POST_MAX_SIZE', '10MB');

but when I am running phpinfo() it doesn't shows the updated value.

It shows

upload_max_filesize = 2M

I am wondering how it is possible??

Eun
  • 4,146
  • 5
  • 30
  • 51
Nirali Joshi
  • 1,968
  • 6
  • 30
  • 50

2 Answers2

1

Do you have access to your Apache configuration ?

Maybe theses parameters are overridden in the virtual host of the Apache configuration via php_admin_value. If this is the case, then you won't be able to change this value in the php script itself.

Also, check the following post : Changing upload_max_filesize on PHP

Good luck with that.

Community
  • 1
  • 1
Thibault
  • 1,566
  • 15
  • 22
0

Firstly, it is very common for your environment to contain several php.ini files, where the one you're editing is not actually being used. Check php_info() output for the path to the loaded configuration file to double check.

If it's definitely correct, restart your web server and double-check it's still not loading.

If you still got no luck, have a look at the return values for ini_set():

if(ini_set('upload_max_filesize', '10M') === FALSE ||
   ini_set('POST_MAX_SIZE', '10MB') === FALSE)
{
    echo "Failed to set a configuration parameter.";
} else {
    // These functions returned strings containing the old value.
}

Let us know what the above returns for you.

deed02392
  • 4,799
  • 2
  • 31
  • 48