Edit report at http://bugs.php.net/bug.php?id=53011&edit=1
ID: 53011 Updated by: cataphr...@php.net Reported by: saurabh0 at gmail dot com Summary: Error using relative paths are used with *only* Read permissions -Status: Open +Status: Duplicate Type: Bug Package: Filesystem function related Operating System: Windows Server 2003 PHP Version: 5.3.3 Block user comment: N New Comment: Closing as duplicate of bug #50163. Continue the discussion there, as Pierre has it picked it up over there. Previous Comments: ------------------------------------------------------------------------ [2010-10-07 16:08:48] saurabh0 at gmail dot com Some additional info: var_dump(getcwd(), realpath(".")); gives: string(7) "c:\php5" string(7) "C:\php5" As expected, when you give "List Folder Contents" permission (in addition to read) to the web root folder both functions return the correct path. ------------------------------------------------------------------------ [2010-10-07 15:51:56] saurabh0 at gmail dot com Description: ------------ Running PHP Version 5.3.3 (FastCgi, non-thread safe) on IIS6/Windows Server 2003. All file functions give error when relative paths are used and with *only* Read permissions on the folder. e.g. file_get_contents('./path/file.txt'); The above gives: Warning: file_get_contents(./path/file.txt): failed to open stream: No such file or directory If you give the full path to the same file it works fine. i.e. the follow works: file_get_contents('C:/full/path/file.txt'); If you add "List Folder Contents" permission to the folder it starts to work with relative folders as well. I am guessing the when relative paths are used php tries to get some information about the current folder which fails as the "List Folder Contents" is not given. There is no need to "List Folder Contents" just to read a file (even if the path is relative). This bug has been reported before but not fixed: http://bugs.php.net/bug.php?id=50163 Note: I had php (5.2) running as ISAPI before and didn't have this problem. So it seems to be specific to non-thread safe version. Test script: --------------- file_get_contents('./path/file.txt'); Expected result: ---------------- No error Actual result: -------------- Warning: file_get_contents(./path/file.txt): failed to open stream: No such file or directory ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53011&edit=1