Page 1 of 1

fopen across windows network

Posted: Thu Sep 28, 2006 4:26 pm
by steverippl
I'm trying to open a file on a network server other than the webserver, so I try...

Code: Select all

$fh = fopen('\\\\server\\drive\\file.ext' ,'r') or die("can't open log file.");
or any version of it with \ or / and I get

Code: Select all

Warning: fopen(\\wsdcache\c$\test.txt) [function.fopen]: failed to open stream: Invalid argument in G:\random\test.php on line 17
I can open the file just fine on the local machine, just not on a networkered server. The only reference to it I've found is one 3 year old post on opendir() about allowing nullSessions connections to the server... Is this me or windows or what?

Posted: Thu Sep 28, 2006 4:34 pm
by volka
steverippl wrote:I can open the file just fine on the local machine, just not on a networkered server.
Maybe your user account has the privileges needed but the account of the php process does not.
Who/what is executing the php script? An apache(+php module) installed as service?

Posted: Thu Sep 28, 2006 4:44 pm
by steverippl
It's a php script running on an IIS (6) server. It's running in a virtual directory in IIS (a test partition on the webserver) which you need to log in as administrator to get into... I don't know if that means the script is running as administrator. I'm running php as the cgi extension.

Posted: Thu Sep 28, 2006 5:13 pm
by volka
steverippl wrote:I don't know if that means the script is running as administrator.
Me neither. I vaguely remember the possibility to let the IIS impersonate the client's identity.
By default the cgi process should have the privileges of the account IUSR_computername.