Nirali Joshi
Nirali Joshi

Reputation: 2008

Can't get php.ini's updated value

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??

Upvotes: 3

Views: 354

Answers (2)

deed02392
deed02392

Reputation: 5022

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.

Upvotes: 0

Thibault
Thibault

Reputation: 1596

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.

Upvotes: 1

Related Questions