Search code examples
phpserveriniini-set

ini_set is NOT setting the values inside php.ini


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 ?


Solution

  • 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.