Jump to content

Accessing files/dir on a Windows network


royrules22

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.