Cakephp权限被拒绝Fileengine.php [英] Cakephp Permission denied Fileengine.php

查看:200
本文介绍了Cakephp权限被拒绝Fileengine.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行以下蛋糕命令:

I am running the following cake command:

./Console/cake schema create DbAcl

现在数据库表已创建,但最后我得到以下错误:

Now the database tables are created but at the end im getting the following error:

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到所有的文件夹,并重做命令,但没有任何运气。任何人都可以告诉我如何解决这个问题?

Now I added chmod 755 to all of the folders, and redone the command, but without any luck. Can anyone tell me how can I fix this?

更新

信息:

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

Here is my rights to the folders mentioned above:

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

另请注意,我无法打开或运行我的任何操作和视图,而无法获取相同的消息

Also note that i cannot open or run any of my actions and views without getting the same messages

更多信息

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 ,因此您对这些文件没有写入权限:

You (user marc) are not in group www-data, so you have no write access to the files:

myapp_cake_core_file_map
myapp_cake_core_method_cache

我建议删除这些文件, chmod 755 c> tmp 文件夹,并让CakePHP创建它们。要让CakePHP创建tmp文件只需访问应用程序的任何网页,而不是运行控制台命令。

I recommend to delete those files, set chmod 755 for all tmp folders, and let CakePHP to create them. To let CakePHP create tmp files just access any web page of your application, not run console command.

您将看到文件的所有者,您将知道您的应用程序运行的用户。

You will see then who is owner of the files, and you'll know user under which your application runs.

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

If after this you'll need to use cake console command, just add yourself to the group of application:

usermod -a -G www-data marc

这篇关于Cakephp权限被拒绝Fileengine.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆