Following this answer, I added the path in the php.ini file, but I'm still getting the below warning/error message:
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
I was told that the S:/ drive is not on the Microsoft IIS webserver that web files are hosted on and it is a Linux NAS that requires a username & password to get into it. It has been mapped to the webserver, but can't seem to access it via PHP. The person who told me this information works in network and says it's a path problem, which falls in my domain, but I'm thinking it's a permission thing, which goes back to him, passing the hot potato of accessing this drive back & forth for a week. Neither of us can seemingly bridge the gap.
The PHP code:
<?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';
}
?>
So my question is the title: What are the possible reasons as to why a PHP operation is not permitted?
new information: So I added the is_readable() function suggested by someone in the comments. Below is the new error:
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
Any reasons as to why this happening?