Cakephp权限被拒绝Fileengine.php

我正在运行以下cake命令:

./Console/cake schema create DbAcl

现在创建了数据库表,但最终我收到以下错误:

Warning: SplFileInfo::openFile(/var/www/bloglic-2013/cake/app/tmp/cache/persistent/myapp_cake_core_object_map): failed to open stream: Permission denied in /var/www/bloglic-2013/cake/lib/Cake/Cache/Engine/FileEngine.php on line 313


Warning Error: SplFileInfo::openFile(/var/www/bloglic-2013/cake/app/tmp/cache/persistent/myapp_cake_core_file_map): failed to open stream: Permission denied in [/var/www/bloglic-2013/cake/lib/Cake/Cache/Engine/FileEngine.php, line 313]

Warning Error: _cake_core_ cache was unable to write 'file_map' to File cache in [/var/www/bloglic-2013/cake/lib/Cake/Cache/Cache.php, line 309]

Warning Error: SplFileInfo::openFile(/var/www/bloglic-2013/cake/app/tmp/cache/persistent/myapp_cake_core_method_cache): failed to open stream: Permission denied in [/var/www/bloglic-2013/cake/lib/Cake/Cache/Engine/FileEngine.php, line 313]

Warning Error: _cake_core_ cache was unable to write 'method_cache' to File cache in [/var/www/bloglic-2013/cake/lib/Cake/Cache/Cache.php, line 309]

现在,我将chmod 755添加到所有文件夹,并重做了该命令,但是没有任何运气.谁能告诉我该如何解决?

更新资料

了解更多信息:

这是我对上述文件夹的权利:

marc@Marc> cd /var/www/bloglic-2013/cake
marc@Marc> ls -ld app/tmp/cache/persistent/
drwxrwxrwx 2 marc marc 4096 Aug 13 22:50 app/tmp/cache/persistent/

marc@Marc> chmod 755  app/tmp/cache/persistent/
marc@Marc> ls -ld lib/Cake/Cache/
drwxrwxr-x 3 marc marc 4096 Aug  2 10:16 lib/Cake/Cache/

marc@Marc> ls -ld lib/Cake/Cache/Cache.php
-rwxr-xr-x 1 marc marc 16179 Aug  2 10:16 lib/Cake/Cache/Cache.php

marc@Marc> ls -ld lib/Cake/Cache/Engine/
drwxr-xr-x 2 marc marc 4096 Aug  2 10:16 lib/Cake/Cache/Engine/

marc@Marc> ls -ld lib/Cake/Cache/Engine/FileEngine.php 
-rwxr-xr-x 1 marc marc 9759 Aug  2 10:16 lib/Cake/Cache/Engine/FileEngine.php

marc@Marc> ls -ld lib/Cake/Cache/Cache.php
-rwxr-xr-x 1 marc marc 16179 Aug  2 10:16 lib/Cake/Cache/Cache.php

另请注意,在没有收到相同消息的情况下,我无法打开或运行任何操作和视图

更多信息

marc@Marc /var/www/bloglic-2013/cake $ls -l app/tmp/cache/persistent/
total 44
-rw-r--r-- 1 www-data www-data  945 Aug 13 18:45 controllers_hashes.txt
-rw-rw-r-- 1 www-data www-data   43 Aug 13 18:53 myapp_cake_core_acl_en-us
-rw-rw-r-- 1 marc     marc       43 Aug 13 23:04 myapp_cake_core_cake_console_
-rw-rw-r-- 1 marc     marc       43 Aug 13 23:04 myapp_cake_core_cake_dev_
-rw-rw-r-- 1 www-data www-data   43 Aug 13 22:59 myapp_cake_core_cake_dev_en-us
-rw-rw-r-- 1 www-data www-data   43 Aug 13 22:59 myapp_cake_core_cake_en-us
-rw-rw-r-- 1 www-data www-data   43 Aug 13 22:59 myapp_cake_core_default_en-us
-rw-rw-r-- 1 www-data www-data 5686 Aug 13 22:59 myapp_cake_core_file_map
-rw-rw-r-- 1 www-data www-data  163 Aug 13 22:59 myapp_cake_core_method_cache
-rwxr-xr-x 1 marc     marc      441 Aug 13 22:21 myapp_cake_core_object_map

解决方法:

您(用户marc)不在www-data组中,因此您没有对该文件的写访问权:

myapp_cake_core_file_map
myapp_cake_core_method_cache

我建议删除这些文件,为所有tmp文件夹设置chmod 755,并让CakePHP创建它们.要让CakePHP创建tmp文件,只需访问应用程序的任何网页即可,而不运行控制台命令.

然后,您将看到谁是文件的所有者,并且您将知道运行应用程序的用户.

如果之后您需要使用cake console命令,只需将自己添加到应用程序组中即可:

usermod -a -G www-data marc
上一篇:CakePHP 2.0基本身份验证始终提供302重定向而不是未经授权的401重定向


下一篇:CakePHP ACL教程group_id