PHP目录错误-open_basedir限制生效 [英] PHP directory error - open_basedir restriction in effect

查看:119
本文介绍了PHP目录错误-open_basedir限制生效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些PHP代码将在设置目录中创建一个新文件:

I've got some PHP code that'll create a new file in a set directory:

$target_path = "reports/" . basename($Report_Filename) . ".php";
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { /* code here */ }

它运行良好,并且已经运行了几年,很遗憾,我们刚刚转移到了新服务器上,而我现在遇到了这个错误:

It was working perfectly, and has done for some years now, unfortunately we've just moved across to a new server, and I'm now getting this error:

[15-Jul-2010 16:15:48] PHP Warning:  Unknown: open_basedir restriction in effect. File(C:\Windows\TEMP\) is not within the allowed path(s): (C:\inetpub\wwwroot) in Unknown on line 0
[15-Jul-2010 16:15:48] PHP Warning:  File upload error - unable to create a temporary file in Unknown on line 0

请问对此有何建议?我已经检查了文件夹(我要上传到的文件夹和Windows TEMP文件夹)的权限,这很不愉快.我还尝试了php.ini文件的一些调整,特别是'open_basedir'行,但也没有运气.

Any suggestions on a way around this please? I've checked the permissions on the folders (both the folder I want to upload to, and the Windows TEMP folder) with no joy. I've also tried a couple of tweaks to the php.ini file and in particular the 'open_basedir' line, but no luck with that either.

谢谢

推荐答案

我还尝试了php.ini文件的一些调整,尤其是'open_basedir'行,但也没有运气

I've also tried a couple of tweaks to the php.ini file and in particular the 'open_basedir' line, but no luck with that either

然后重试-第一次您做错了.也许其他地方还有其他设置(例如,在Web服务器配置中).

Then try again - you did it wrong the first time. Maybe there's another setting elsewhere (e.g. in the webserver config).

失败了,找出open_basedir是什么,并确保php.ini中的upload_tmp_dir和代码中的$ target_path都在其中.

Failing that, find out what the open_basedir is and make sure that your upload_tmp_dir in php.ini and the $target_path in your code are both inside it.

C.

这篇关于PHP目录错误-open_basedir限制生效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆