mija Posted July 2, 2013 Share Posted July 2, 2013 I have php on Windows 7 and I'm trying to connect to Samba Shared folder on Linux but no success. I'm using this code: // Map the drivesystem('net use Y: "\\\\linuxIPaddress\Shared_folder password /user:username /persistent:no>nul 2>&1');// Open the directory$dir = "Y:/TMP";if (is_dir($dir)) {if (opendir($dir)) {print "able to access directory tree.";}} else {print "not access tree.";} Quote Link to comment https://forums.phpfreaks.com/topic/279782-im-trying-to-connect-from-windows-to-samba-shared-folder-on-linux-using-php/ Share on other sites More sharing options...
Solution mija Posted July 2, 2013 Author Solution Share Posted July 2, 2013 i found solution for connection using this code $sharename = '\\\\LinuxIPAddress\Shared_folder'; $username = 'username'; $password = 'password'; $letter = 'Z:'; if (!is_dir($letter . "/TMP")) { if (!opendir($letter . "/TMP")) { $WshNetwork = new COM("WScript.Network"); $WshNetwork->MapNetworkDrive($letter, $sharename, FALSE, $username, $password); } } and is working perfect Quote Link to comment https://forums.phpfreaks.com/topic/279782-im-trying-to-connect-from-windows-to-samba-shared-folder-on-linux-using-php/#findComment-1439034 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.