go to bug id or search bugs for
file_exists returns false if the file path is a symlink
> mklink /D c:\inetpub\wwwroot\myfolder d:\myfolder
Add a Patch
Add a Pull Request
Correction: file_exists does ALWAYS return false, even for normal file pathes
Please check if you have the correct permissions.
c:\php53rc3tsvc9x86> php -r "var_dump(file_exists('news.txt'));"
c:\php53rc3tsvc9x86> php -r "var_dump(file_exists(realpath('news.txt')));"
c:\php53rc3tsvc9x86> php -r "var_dump(file_exists(realpath('news123.txt')));"
same with VC6 builds.
I suspect David is right, the console may be run under a user not having the permissions to access c:\inetpub (5.3 has ACL supports now and actually returns the right info).
User group EVERYONE has full permissions.
Other operations are working on that file:
e.g. include_once, file_get_contents
I use 2008 as well and it works fine. Can you add perms for your user specifically and test again?
detailed system information
* Windows Server 2008
* IIS7 with Fast-CGI installed
* PHP5.3 ((5.3.0RC3) VC9 non thread safe from http://windows.php.net/qa/ (tried also VC6 and thread safe version)
The problem occurs only if executing the script from the web server.
I run the same script from the console and it works.
The permissions are set correctly (full permissions to everyone), as I can read and modify the file via PHP (running on IIS).
I use 2008 as well and it works fine. Can you add perms for your user
specifically and test again? take #2
I've set the setting fastcgi.impersonate in php.ini to 1 (like recommendet in the documentation).
If I set it to 0 it works.
thanks for the update, I have to figure out what's wrong.
Please try using this CVS snapshot:
A fix has been applied to 5.3, please try it
Now it works!
But realpath doesn't work for symlinked pathes anymore (it returns false).
Tried the RC3 realease again and there it works.
Has it something to do with the actual fix or should I open a new bug submission?
realpath works here (all tests machine) with symlink. Do you have an example (path used, dir or files?, etc.)
I have a deep folder structure. For example i made a symlink (mklink /d) from a folder located on drive d: to a folder on drive c:
D:\root\web\wwwtypo35 -> C:\inetpub\wwwtypo35
If I call now realpath() for "C:\inetpub\wwwtypo35\Packages\Global\FLOW3\Classes\Package\Package.php" it returns false on the latest snapshot version of PHP. If I try the RC3 release it works and the function returns the full path.
Maybe the bug exists because I made a symlink to a path on another drive?
We have the same problem on our Windows Vista developer machines. Links were made with the tool junction.exe (because the links need to work on both Windows XP and Windows Vista).
The problem was fixed in Vista when the old links were replaced by new mklink links.
We haven't tried PHP 5.3 on XP yet.
symlink are not junctions!
use mklink to create symbolic or hard links.
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
See #48746 for further comments or feedback.