php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48852 php windows save file to remote share strange access denied
Submitted: 2009-07-08 14:01 UTC Modified: 2010-03-18 17:22 UTC
From: trutas dot ctx at gmail dot com Assigned:
Status: Not a bug Package: IIS related
PHP Version: 5.3.2 OS: Windows Server 2003 x64 IIS6.0
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: trutas dot ctx at gmail dot com
New email:
PHP Version: OS:

 

 [2009-07-08 14:01 UTC] trutas dot ctx at gmail dot com
Description:
------------
Access denied on a simple file_put_contents 
- the strange thing is vbscript test file on the same folder works 
- destination has everyone->modify/read/write.

localhost/test.asp
localhost/test.php

i think it is not relevant but test.php and test.asp are located on the same \\share that we're trying to save the file to (but on a different folder). Apparently it works if we map this share to a local drive and use the local path (eg. E:\ );

file_get_contents works fine.

We are using Windows 2003 Server x64, IIS 6.0, PHP 5.3RC04 x64 via MS FastCGI .




Reproduce code:
---------------
<?php
file_put_contents("\\\\share\\intraroot$\\folder\\file.txt", "...");
?>

Expected result:
----------------
file saved with content "..."

Actual result:
--------------
PHP Warning:  file_put_contents(\\share\intraroot$\folder\file.txt): failed to open stream: Permission denied in ...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-08 15:03 UTC] pajoye@php.net
How did you install php? FCGI or ISAPI?
 [2009-07-08 15:13 UTC] trutas dot ctx at gmail dot com
Note:
test.php is located at \\share\intraroot$\site\

i've just tested it further and tryed a few workarounds:
- it doesn't work with relative path (since both files are within the same share) "..\\folder\\file.txt";
- it doesn't work with dirname(__FILE__)."\\..\\folder\\file.txt";
- does not work with forward slashes //share/...
- the error is "permission denied" even if the destination folder doesn't exist - i've found this because at a time i had wrongly typed \\\\share\\intraroot$folder\\file.txt - that does not exist;

I'm guessing it has something to do with the home directory in IIS being on a remote share - the production servers are clustered...

Every other technology (vbscript, .NET) on IIS accesses the shares normally.
 [2009-07-08 15:15 UTC] trutas dot ctx at gmail dot com
FastCGI
 [2009-07-08 15:18 UTC] pajoye@php.net
Be sure that you configured the user correctly or that the user has the correct access.
 [2009-07-08 15:56 UTC] trutas dot ctx at gmail dot com
i have installed and configured as recommended at http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/

can i further configure the FastCGI/PHP user anywhere else? 

IIS user is configured correctly (- home directory with Run as trustedDomain\iisuser) and the destination folder has trustedDomain\iisuser modify and everyone modify .

Regards,
 [2009-07-17 10:06 UTC] trutas dot ctx at gmail dot com
don't know if it helps, but here are some example details from phpinfo();
_SERVER["APPL_MD_PATH"]	/LM/W3SVC/1897346991/Root/webservices/Cacher
_SERVER["APPL_PHYSICAL_PATH"]	\\ptlisi020dat\intraroot$\CIO\Webservices\Cacher\

I haven't tried using APPL_MD_PATH, but with APPL_PHYSICAL_PATH it doesn't work.
 [2010-03-18 16:44 UTC] kalle@php.net
-Status: Open +Status: Feedback
 [2010-03-18 16:44 UTC] kalle@php.net
Is this also reproducable on PHP 5.3.2?
 [2010-03-18 17:14 UTC] trutas dot ctx at gmail dot com
-Status: Feedback +Status: Open -PHP Version: 5.3.0 +PHP Version: 5.3.2
 [2010-03-18 17:14 UTC] trutas dot ctx at gmail dot com
Apparently it's ok now.

I have no idea what solved it and whether it was the administration team changed 
something on permissions/users or the PHP Version update :/

Thanks
 [2010-03-18 17:22 UTC] pajoye@php.net
-Status: Open +Status: Bogus
 [2010-03-18 17:22 UTC] pajoye@php.net
not a bug > bogus :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 08:01:28 2024 UTC