purpleoak
asked on
PHP access a Mapped network drive running on Xampp
I have a Xampp installation running on windows server 2003. This has a mapped network drive to a text file. I cannot read or even see the file with php (see code) I also tried fopen. I have full access to the file under windows.
I have set the Apache service to run as a domain administrator as a test however this still didn't work. I did this via the MMC service control panel logon as. option.
I have set the Apache service to run as a domain administrator as a test however this still didn't work. I did this via the MMC service control panel logon as. option.
<?php
//file path of MEFILTER-BANNED.txt
$filepath = "T:\\Config\\Filters\\Patterns\\MEFILTER-BANNED.txt";
//file path of the log file
$logpath = "log.txt";
//file path of MEFILTER-BANNEDTEMP.txt
$filepathtemp = "T:\\Config\\Filters\\Patterns\\MEFILTER-BANNEDTEMP.txt";
if (file_exists($filepath)) {
echo 'The file is readable';
} else {
echo 'The file is not readable';
}
$fh = fopen($filepath, 'a+') or exit("");
$stringData = $_POST["domain"];
fwrite($fh, "$stringData\r\n") or exit("");
fclose($fh);
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I will try the UNC name then however I have tried the forward slash, double single both directions. I perhaps should have mentioned that. Apologies.
ASKER
UNC path names did the trick. thank you very much spent ages trying to figure that out.
Rather than
$filepath = "T:\\Config\\Filters\\Patt
use
$filepath = "T:/Config/Filters/Pattern