[英]What are the possible reasons as to why an PHP operation is not permitted?
按照此答案 ,我在php.ini文件中添加了路径,但仍收到以下警告/错误消息:
Warning: scandir(): open_basedir restriction in effect. File(S:\Docs) is not within the allowed path(s): (C:\inetPub;S:\Docs) in C:\inetpub\somewhere.com\cr\test.php on line 25
Warning: scandir(S:\Docs): failed to open dir: Operation not permitted in C:\inetpub\cr\somewhere.com\test.php on line 25
Warning: scandir(): (errno 1): Operation not permitted in C:\inetpub\somewhere.com\cr\test.php
有人告诉我S:/驱动器不在Web文件所在的Microsoft IIS Web服务器上,它是Linux NAS,需要用户名和密码才能进入。 它已映射到Web服务器,但似乎无法通过PHP访问它。 告诉我此信息的人在网络中工作,并说这是路径问题,该问题属于我的领域,但我认为这是允许的事情,它又回到了他身上,来回传递访问此驱动器的棘手问题一个星期。 我们俩似乎都无法弥合差距。
PHP代码:
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$files = scandir('S:\Docs');
var_dump($files);
$filename = 'S:\Docs\cr\text.pdf';
if (is_readable($filename)) {
echo 'good';
} else {
echo 'bad';
}
?>
所以我的问题是标题:为什么不允许进行PHP操作的可能原因是什么?
新信息 :因此,我在注释中添加了某人建议的is_可读()函数。 以下是新错误:
is_readable(): open_basedir restriction in effect. File(S:\Docs\cr\text.pdf) is not within the allowed path(s): (C:\inetPub;S:\Docs) in C:\inetpub\somewhere.com\cr\test.php on line 34
任何原因 ,为什么会这样呢?
检查是否在指向不同目录的INI文件中设置了“ open_basedir”。
基本上,open_basediris用于限制或限制目录访问。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.