I’ve done a bunch of research on this one and there are very different answers. I can’t get confident that I won’t mess up my Apache settings or cause me not to be able to get to the Volume from Mac Finder after making changes.
Has anyone done this recently that can walk me through the steps to get my PHP/Apache local site on Mac read from an external NAS /Volume. I want to use scandir
to read the files list.
The PHP code is simple, and works on my local disk, but not on a /Volume
$path = '/Volumes/Nas/Files'; $files = scandir($path); print_r($files);
Getting error scandir(/Volumes/Nas/Files): failed to open dir: Permission denied
Thanks.
Advertisement
Answer
Get user name running the php script, see https://www.php.net/manual/en/function.get-current-user.php, and then fix file permissions for that user.
If absolutely needed, you can use bindfs to translate the permissions for your script/user.