0

I am trying to load a file from a mapped network drive on Windows Server 2008. The mapped drive is S:\ and the file is conqueror.mdb. I am using the IP address I am seeing in File Explorer but it still says it cannot find the file.

$dbName = "\\xx.xx.xxx.xx\S:\conqueror.mdb";

if (!file_exists($dbName)) {
    die("Could not find database file.");
}


$conn = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbName; Uid=; Pwd=pass;");
626
  • 1,159
  • 2
  • 16
  • 27
  • Use single quotes instead of double quotes for `$dbName` assignment. – Barmar Aug 03 '17 at 22:57
  • I tried that and still get the same error. – 626 Aug 03 '17 at 23:01
  • Can you access that file from the Command Prompt? – Barmar Aug 03 '17 at 23:09
  • 1
    I don't use Windows, but if `S:` is mapped to the network drive, why do you need to put `\\xx.xx.xxx.xx` before it? Can't you just write `S:`? – Barmar Aug 03 '17 at 23:09
  • Note that Mapped Network drives are only per-user, not systemwide. If your PHP process is running under a different user-account compared to your local desktop account (which they usually are, such as `NETWORK SERVICE` or as a dedicated IIS Application Pool process) then the driver mappings will not be available. – Dai Aug 03 '17 at 23:14
  • I've tried it with just `S:` but the same thing. I am pretty sure it's the issue @Dai suggested. – 626 Aug 03 '17 at 23:27

0 Answers0