Edit report at https://bugs.php.net/bug.php?id=52376&edit=1
ID: 52376 Comment by: marc dot seitz at ww-informatik dot de Reported by: ryan at kisc dot edu dot np Summary: opendir() cannot open UNC paths in IIS7 using passthrough auth. Status: Assigned Type: Bug Package: *Directory/Filesystem functions Operating System: win64 - W2008R2 PHP Version: 5.3.2 Assigned To: pajoye Block user comment: N Private report: N New Comment: Hi Guys, we have exactly the same problem now. We want to migrate to Windows Server 2008 R2 with IIS 7.5, FastCGI, PHP 5.3.6. When I try to do a file_get_contents(<UNC-PATH>) or opendir(<UNC-PATH>) I always will get the error: Warning: fopen(<UNC-PATH-TO-FILE>): failed to open stream: Permission denied in D:\inetpub\wwwroot\XXX.php on line 26 The Application-Pools of the IIS are running under a Domain-Account which has access to the Network Share. I don't know how to solve this problem. Any ideas of you? Thanks Marc Previous Comments: ------------------------------------------------------------------------ [2011-01-13 04:24:50] mark at internode dot on dot net Hi I am having the same problem with PHP 5.3.5 running under IIS 7.5, FastCGI, Windows Server 2008 R2 where I am simply trying to access a file on another server using a UNC path. $uploadfile = "\\<server>\<share>\<folder>\<file>.txt"; $fh = fopen($uploadfile, 'r') or die("Can't open file $uploadfile"); I have tried granting "everyone" full permissions for the share and the file system but it still does not work. This code works perfectly if the file is stored on the same server and is accessed through a local path. Other things I have tried inlcude: - setting the defaultappool to use a specific user and granting that user permissions on the share and file system - using "network" as above Any other ideas on this one? ------------------------------------------------------------------------ [2010-07-20 04:42:43] ahar...@php.net (Restoring status.) As a fellow Chrome user, I feel your pain. :) ------------------------------------------------------------------------ [2010-07-20 04:08:58] ryan at kisc dot edu dot np sorry about the line breaks, apparently this site doesn't like what Chrome does when I resize the text box. I'll be more careful in the future. Actually this site seems to hate Chrome altogether. I keep getting "incorrect username" constantly. The bug site is buggy, at least in Chrome. ------------------------------------------------------------------------ [2010-07-20 04:04:31] ryan at kisc dot edu dot np Well, that allows me to browse to the folder via chrome and essentially does the same thing as the workaround from #50542 but only on the one folder which could work. What it does not appear to do is give me programmatic access to the folder. The instructions in that KB are outdated as it uses adsutil.vbs and the setting is the same as the "Physical Path Credentials" from the IIS manager. This could work, in a much less than ideal way, if there is some way to run "opendir" on the virtual directory without specifying the unc path (since the UNC path itself still does not work). I could just be unaware of how, since it seems to use the system paths and not honor or even acknowledge virtual directories. I tried lots of different formats against my better judgement but none worked. I even tried using the http path reference. Still no joy. I've used PHP since 1998 but realize something could have changed at any one of the releases, however I'm not sure I see how a virtual directory could solve the ability to use opendir. Fair enough if this was just a try. I'm happy to keep trying if it can help the community. This worked fabulously in IIS6. I also confess that it appears to be Microsoft's fault. Very frustrating. I wonder if I can create a symbolic link equivalent. I've done this before in older versions of windows, but I don't think I've ever done it to a network share. In my case I may be able to just move the share to the IIS server and be done with it, but I'm willing to stick this out if it will help find a solution to this issue. ------------------------------------------------------------------------ [2010-07-19 23:50:21] paj...@php.net Can you try to follow the advice here please: http://support.microsoft.com/kb/214806 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=52376 -- Edit this bug report at https://bugs.php.net/bug.php?id=52376&edit=1