Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Aug 2009
    Location
    Asheboro, NC
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error: "failed to open dir: No error" with opendir on network drive

    I'm trying to open a network drive, but am getting the error "failed to open dir: No error"

    Here is my code:
    Code:
    // Parameters to map network drive
    $drive = "Z";
    $path = "\\server\share";
    $user = "domain\user";
    $pass = "pass";
    
    // Map the drive
    system("net use ".$drive.": \"".$path."\" ".$pass." /user:".$user." /persistent:no>nul 2>&1");
    
    // Open folder
    $dir = opendir("Z:\\") or die('Unable to open '.$path.);
    I can run the opendir with C: and open a local folder without any issues, but attempting to access the Z: gives the error. I figure it's an authentication issue, so I've gone to the server and made sure that the "domain/user" I'm using has full permissions for that share, but I still get the error.

    Do I need to add more permissions elsewhere or is this a different issue?

    I also ran the net use command in a windows cmd prompt to make sure there were no bugs there, it ran fine. Both computers are running XP Pro and I'm coding on Xampp 1.7.2.

    Any help would be much appreciated.

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    this seems to be a common issue with on common fix.

    I'm wondering if it might have something to do with the auth type used by windows file sharing. I assume that you can access the share via the local system?

  • #3
    New to the CF scene
    Join Date
    Aug 2009
    Location
    Asheboro, NC
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes I can open the share locally and have full permissions to it.

  • #4
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    maybe just for testing purposes try removing all permissions on the share, so that it requires no login, then try again and see what happens. this might give us a better idea of what the issue could be.

  • #5
    New to the CF scene
    Join Date
    Aug 2009
    Location
    Asheboro, NC
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, I've tried giving everyone full control and I've tried removing the users and everyone from the permissions tab. Same error. Also tried adding my domain/user to the normal security tab with full control just in case. Same error both with and without users in the permissions tab.

  • #6
    New to the CF scene
    Join Date
    Aug 2009
    Location
    Asheboro, NC
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've rigged up a temporary work around for now... Since the main purpose of my connection was to store data from some files and then archive the files. I've created a simple batch script that copies the files from the network share to a folder in the webserver and then archives the files on the share. Now I can just work with the files that are copies over and delete them as I finish pulling the data I need. End result is the same as what I wanted, although the method is far less elegant...


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •