royrules22 Posted July 23, 2007 Share Posted July 23, 2007 Hi, I need to access files on a Windows network. So basically the location would be \\server\dir1\dir2 or something like that. I'm running this PHP script on a different server (call it serv2) that runs IIS. My code is something like this: $dir = "\\server\dir1\dir2"; if (is_dir($dir)) { echo "IS DIR!\n"; if ($dh = opendir($dir)) { /*More stuff*/ It doesn't even recognize it as a directory. Now I figure the problem is authentication. Basically all users in a domain (call it 'allusers') can access server and these files. But the scripts in serv2 (the one where PHP runs) is authentication anonymously using the account ISUR_SERV2, which is an account local to the serv2 server and not in the domain 'allusers'. So I tried authenticating just this script using an account in the allusers domain (my own). However it still doesn't work. And I know for a fact that serv2 is connected to the network. Any help? Thanks Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 23, 2007 Share Posted July 23, 2007 use the full directory path. Quote Link to comment Share on other sites More sharing options...
royrules22 Posted July 23, 2007 Author Share Posted July 23, 2007 Full directory path as in? I'm confused sorry. Windows Server 2003 BTW. Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 23, 2007 Share Posted July 23, 2007 use the ip of the server running the code. Quote Link to comment Share on other sites More sharing options...
royrules22 Posted July 23, 2007 Author Share Posted July 23, 2007 IP address of the machine running the code or the machine in which the files reside? I'm assuming the latter right? Quote Link to comment Share on other sites More sharing options...
stlewis Posted July 24, 2007 Share Posted July 24, 2007 Actually, (and please correct me if I'm wrong...I'd like to be wrong about this, as it would make my life easier...but the readdir() function doesn't work on a remote server, hence the error. The script needs to reside in the same server as the directory you want to read. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.