PHP chmod permission denied

Jun picture Jun · Aug 23, 2013 · Viewed 7.7k times · Source

I am using mac and try to unlink a file via PHP:

$old_path = 'tmp/table.csv';
if(file_exists($old_path)){
   chmod($old_path, 777);
   unlink($old_path);
}

It looks like chmod is permission denied. I searched online but get no ideas. Someone says chown, how does it work?

Answer

Jeroen Ingelbrecht picture Jeroen Ingelbrecht · Aug 23, 2013

The user executing the command has no rights to execute the chmod command.