.htaccess :: Cannot set a upload_tmp_dir

11.3k views Asked by At

Looks like a very simple task but it's not working... I'm trying to set upload_tmp_dir to the ROOT directory on my .htaccess file...

php_value upload_tmp_dir /

I'm printing out the results and it's stays the same as the default on my php.ini

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

IOW... not working.

I know that it's impossible to set it via :

ini_set('upload_tmp_dir','/');

What am I doing wrong here ?

2

There are 2 answers

0
donald123 On

The temporary directory used for storing files when doing file upload. Must be writable by whatever > user PHP is running as. If not specified PHP will use the system's default.

If the directory specified here is not writable, PHP falls back to the system default temporary directory. If open_basedir is on, then the system default directory must be allowed for an upload to succeed.

as you can see on ini.upload-tmp-dir

So check if open_basdir is on and new directory is writeable (which i think will not be writable you set it to root

0
Jeremy On

Not all variables work inside of ini_set and upload_tmp_dir is one of them because it must be set before PHP executes. You can this variable in either the php.ini file directly or by adding it to your .htaccess file like so: php_admin_value upload_tmp_dir /new/temp/path