1

看起来像一个非常简单的任务,但它不工作......我正在尝试upload_tmp_dir在我的 .htaccess 文件中设置为 ROOT 目录......

php_value upload_tmp_dir /

我正在打印结果,它与我的 php.ini 上的默认值保持一致

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

爱荷华...不工作。

我知道通过以下方式设置它是不可能的:

ini_set('upload_tmp_dir','/');

我在这里做错了什么?

4

2 回答 2

1

文件上传时用来存放文件的临时目录。必须可由任何 > 用户 PHP 运行的对象写入。如果没有指定 PHP 将使用系统的默认值。

如果此处指定的目录不可写,PHP 将回退到系统默认的临时目录。如果 open_basedir 打开,则必须允许系统默认目录才能成功上传。

正如您在ini.upload-tmp-dir上看到的

所以检查open_basdir是否打开并且新目录是可写的(我认为这将是不可写的,你将它设置为 root

于 2014-12-22T14:24:26.570 回答
0

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

于 2020-01-06T16:48:38.040 回答