0

I'm working on an IIS server environment with php and having issues getting proper responses from is_readable() over a unc path. I've checked that the file is valid and accessible to the IUSR_*** that exists with the same password on the file share node and the IIS node.

I've tested file_exists() which returns true. Can anyone shed some light on the underlying checks that are different between file_exists() and is_readable()?

vfssean
  • 1
  • 1
  • Read this question and esp[ecially the answer by James: http://stackoverflow.com/questions/6604726/file-exists-or-is-readable – Erwin Moller Dec 30 '15 at 14:54
  • Thanks for the reply. I've run tests with nearly all fs functions without any helpful output. It seems `is_readable()` and `is_writeable()` are the only ones that have issues. The problem is i can't change the logic of the application I'm running. I need to find out why `is_readable()` is returning false. I saw a reference in the php manual to `UID/GID` being checked against but with this being a windows environment I don't think the `UID/GID` will be applicable. Could that be an issue? I've also checked `get_current_user()` and am getting the proper `IUSR_***` that has proper permissions. – vfssean Dec 30 '15 at 15:23
  • Hmm, I am using unc paths in PHP here (SBS2008 environment). You could try this: replace the servername with its IP. I googled for you and ended up, on SO of course. :) http://stackoverflow.com/questions/16704253/php-open-basedir-with-unc-path – Erwin Moller Dec 30 '15 at 15:31
  • ANother thing: I seem to remember that IUS_* also needs permissions on the directory which holds the file. Can't remember the details... You could try that too. – Erwin Moller Dec 30 '15 at 15:33
  • All paths eventually lead to SO lol. I tried using the ip without success. I've spent hours on this one googling far and wide without anything that seems to pinpoint a single issue. I'm beginning to wonder if this could be a impersonation issue with fastcgi and php. – vfssean Dec 30 '15 at 15:36
  • I have the `IUSR_***` setup with permissions to the "site root" folder as well. – vfssean Dec 30 '15 at 15:37
  • What exactly goes wrong with is_readable() over unc path? DOes it always return true or false? Or reports wrong? – Erwin Moller Dec 30 '15 at 15:43
  • `is_readable()` always returns false for files on the unc path. If i alter my test script to check a file local to the IIS node, it returns true. So it would seem that any file on a unc path returns false even when permissions are set properly. – vfssean Dec 30 '15 at 15:45
  • I checked over here, and found out I had the same issues earlier. They disappeared when I moved the files to the same physical machine. If that is not an option for you, you can maybe write an interface to the other machine (just PHP that receives your requests and tests them locally). I have no idea if that is a viable option for you. – Erwin Moller Dec 30 '15 at 16:06
  • Unfortunately, moving the files locally isn't an option. Can you elaborate on this "interface"? – vfssean Dec 30 '15 at 16:40
  • Sure, just a simple PHP interface on the 'fileserver' machine that takes requests only from your machine (IP-check, or something more elaborate). It takes for example http : // fileserver/myhelper.php?action=isreadable&file=xyz. Then it responds with a true or false. You just move your testing logic to the real machine. (Of course this is a workaround because those pesky unc paths are so troublesome) – Erwin Moller Dec 30 '15 at 17:20

0 Answers0