3

我正在运行以下 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
4

1 回答 1

3

您(用户marc)不在 group 中www-data,因此您对文件没有写入权限:

myapp_cake_core_file_map
myapp_cake_core_method_cache

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

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

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

usermod -a -G www-data marc
于 2013-08-13T21:44:26.523 回答