fopen across windows network

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
steverippl
Forum Newbie
Posts: 2
Joined: Thu Sep 28, 2006 4:12 pm

fopen across windows network

Post 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?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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?
steverippl
Forum Newbie
Posts: 2
Joined: Thu Sep 28, 2006 4:12 pm

Post 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.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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.
Post Reply