I have tried this:
echo substr(sprintf('%o', fileperms($mdbFilename)), -4).'<br />';
echo chmod($mdbFilename, 0777);
echo substr(sprintf('%o', fileperms($mdbFilename)), -4).'<br />';
The out put I get for the above is:
0666
1
0666
So the above has not worked! Why is this the case? And why does chmod report true?
The variable $mdbFilename contains the path to the file which is C:\wamp\www\webs\db\access_db_1276264459.mdb
Any help will be appreciated.
Windows does not support the *NIX octal permissions.
Edit: You may also want to try clearing the stat cache before you re-read the file’s permissions, ala Pekka’s response.
Edit #2: Since a permission of
0777specifies that the file is executable, why would you even want to do that to the file?It’s an MDB file, or a Microsoft Access™ database file. Why would that ever need to be executed? I think Windows determines whether something is executable by its having an executable extension (like
.EXE,.BAT, or.COM).