Cakephp Permission denied Fileengine.php

六眼飞鱼酱① 提交于 2019-12-12 13:17:20

问题


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]

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?

Update

Abit more information:

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

More information

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

回答1:


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

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.

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


来源:https://stackoverflow.com/questions/18219172/cakephp-permission-denied-fileengine-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!