CakePHP将具有不同所有者/组的文件写入服务器所有者/组

Am using CakePHP 2.2.2 and in order to write/delete files/symlinks to a folder have to set containing folder permissions to 0777 as writes seem to be using different owner/group names to those of CakePHP script files. This creates problems when using the same scripts to delete the files/symlinks that they created and also when trying change permissions/delete files via ftp client. Any pointers on how to resolve this issue?

The problem is that your FTP user cannot delete the files created by the webserver. You have mainly two options:

  • Let a PHP-script delete these files (so the files will be deleted by the owner who created them);
  • Have a root- or admin-user delete these files.

The last one will be difficult on a shared hosting server, so the first one will probably be your way to go...