Unlink permission denied

I’m trying to delete a file,

chmod($file,0775);
unlink($file);

but I get warning

Warning: unlink(mytest.log): Permission denied in

I don’t know why.

Try checking the parent directory permissions.

@John_Betong
How to do that ?

Use fileperms to check programmatically. Note - the return of this function is different on Windows than UNIX.

Hi,

Try adjusting the directory permissions, from a terminal, run chmod 777 database (from the directory that contains the database folder)

Hope this helps.

Try adjusting the directory permissions, from a terminal, run chmod 777
database (from the directory that contains the database folder)

“Jackpotting” the file system like that is a security risk. This is fine for a brief test, but the permissions should be set much tighter - to whatever they can get away with being while still working.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.