ini_set is NOT setting the values inside php.ini

2.6k views Asked by At

I'm trying to set a new directory for upload_tmp_dir and set a new upload_max_filesize but it's not working... I'm displaying the results but I'm getting the old (default php.ini settings) back...

ini_set('upload_tmp_dir','/');
ini_set('upload_max_filesize','1024M');

And now let's display the results :

echo 'Your Temp Upload Directory : '.ini_get('upload_tmp_dir').'<br>';
echo 'Your Upload Max Filesize : '.ini_get('upload_max_filesize').'<br>';

The original php.ini default settings is displayed to the screen and not my new settings.

What could possibly be the reason ?

2

There are 2 answers

0
Bogdan Kuštan On BEST ANSWER

Not all php.ini values can be overriden by php_ini() function. Full list could be found here. And changable values could be found here.

Basicly You cannt override these two values in php file.

upload_tmp_dir can be set only in php.ini file and upload_max_filesize can be set in php.ini, .htaccess, httpd.conf or .user.ini files.

0
donald123 On

You can't set all parameters with ini_set()!

Take a look into the appedix-list there you can see which params could be set in wich version in which type