PHP Unlink function Woes on Windows
- by Abs
Hello all,
I am having problems with the PHP function unlink. I keep getting this error:
Warning: unlink(C:\wamp\www\webs\db\db_1276259188.mdb) [function.unlink]: Permission denied in C:\wamp\www\webs\pure-php-export.php on line 242
I am on a windows machine where Apache runs as the user SYSTEM. I have set the permissions of the db folder as "Full Control" for Apache's user.
I thought my script might still be holding on to that file (its an uploaded file that gets used via PDO).
try{
$dbh = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=$mdbFilename", $username, $password);
}catch(PDOException $e){
echo $e->getMessage();
}
So before I attempt to delete the file I unset the above and try to delete like so:
$dbh = null;
unset($dbh);
if(is_file($mdbFilename)){
unlink($mdbFilename);
}
I really appreciate any help on this as it has been driving me mental for the past two hours!
Thanks all for any help.