Basically, I have a script that cannot see an existing directory on the OS X machine. The directory has been copied off an external hard drive onto the desktop, which I think may be the core of the issue.
$path = '/Users/username/Desktop/testfolder';
$path = realpath($path);
This above doesn’t work.
$path = '/Users/username/Desktop';
$path = realpath($path);
This above works fine.
I’ll give you a little context of the situation. I’m running Mac OS X Lion 10.7. I have installed XAMPP. This is a kiosk iMac that needs to communicate with an iPad on the same network, otherwise I wouldn’t be running apache on OS X. The iPad needs to retrieve some images off of the iMac, and the PHP is basically functioning as a proxy to do this. I’ve created a backend that lets the administrator setup the path to the images, which is where this error is occuring.
So, I’m not sure what is going on. I imagine it has to do with some conflict of permissions and owner of these files from the external hard drive. I am sure we could do a “chown” or “chmod” in Terminal, but this isn’t really a great solution. I love to make the PHP accommodate such a scenario. Any thoughts? Please!? 🙂
Kind of a weird issue, but although this works:
The “Desktop” directory didn’t have correct permissions. Once I changed permissions on Desktop, it allowed me to access this path:
The manual does state
The running script must have executable permissions on all directories in the hierarchy, otherwise realpath() will return FALSE.which did seem to be the issue.