1

我第一次尝试运行蛋糕控制台应用程序。从app我正在运行的蛋糕文件夹中,Console/cake我得到以下输出

PHP Warning:  SplFileInfo::openFile(/var/www/virtual_host.com/public_html/app/tmp/cache/persistent/myapp_cake_core_file_map): failed to open stream: Permission denied in /var/www/virtual_host.com/public_html/lib/Cake/Cache/Engine/FileEngine.php on line 314

Warning: SplFileInfo::openFile(/var/www/virtual_host.com/public_html/app/tmp/cache/persistent/myapp_cake_core_file_map): failed to open stream: Permission denied in /var/www/virtual_host.com/public_html/lib/Cake/Cache/Engine/FileEngine.php on line 314

Welcome to CakePHP v2.3.7 Console
---------------------------------------------------------------
App : app
Path: /var/www/virtual_host.com/public_html/app/
---------------------------------------------------------------
Current Paths:

 -app: app
 -working: /var/www/virtual_host.com/public_html/app
 -root: /var/www/virtual_host.com/public_html
 -core: /var/www/virtual_host.com/public_html/lib

Changing Paths:

Your working path should be the same as your application path. To change your path use the '-app' param.
Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp

Available Shells:

[CORE] acl, api, bake, command_list, console, i18n, schema, server, test, testsuite, upgrade

To run an app or core command, type cake shell_name [args]
To run a plugin command, type cake Plugin.shell_name [args]
To get help on a specific command, type cake shell_name --help

Warning Error: SplFileInfo::openFile(/var/www/virtual_host.com/public_html/app/tmp/cache/persistent/myapp_cake_core_file_map): failed to open stream: Permission denied in [/var/www/virtual_host.com/public_html/lib/Cake/Cache/Engine/FileEngine.php, line 314]

Warning Error: _cake_core_ cache was unable to write 'file_map' to File cache in [/var/www/virtual_host.com/public_html/lib/Cake/Cache/Cache.php, line 310]

这是 ls -l 的输出

drwxrwxr-x 3 DevinCrossman DevinCrossman 4096 Jul 16 14:17 Config
drwxrwxr-x 4 DevinCrossman DevinCrossman 4096 Jul 16 14:17 Console
drwxrwxr-x 3 DevinCrossman DevinCrossman 4096 Jul 16 14:17 Controller
-rw-rw-r-- 1 DevinCrossman DevinCrossman  701 Jul 16 14:17 index.php
drwxrwxr-x 2 DevinCrossman DevinCrossman 4096 Jul 16 14:17 Lib
drwxrwxr-x 3 DevinCrossman DevinCrossman 4096 Jul 16 14:17 Locale
drwxrwxr-x 4 DevinCrossman DevinCrossman 4096 Jul 16 14:17 Model
drwxrwxr-x 2 DevinCrossman DevinCrossman 4096 Jul 16 14:17 Plugin
drwxrwxr-x 4 DevinCrossman DevinCrossman 4096 Jul 16 14:17 Test
drwxrwxrwx 6 DevinCrossman DevinCrossman 4096 Jul 16 14:17 tmp
drwxrwxr-x 2 DevinCrossman DevinCrossman 4096 Jul 16 14:17 Vendor
drwxrwxr-x 9 DevinCrossman DevinCrossman 4096 Jul 16 14:17 View
drwxrwxr-x 6 DevinCrossman DevinCrossman 4096 Jul 16 14:17 webroot

我尝试根据this other SO question使用以下内容修改 Config/core.php

Cache::config('_cake_core_', array(
    'engine' => $engine,
    'prefix' => 'cake_core_',
    'path' => CACHE . 'persistent' . DS,
    'serialize' => ($engine === 'File'),
    'duration' => $duration,
    'mask' => 0666
));

Cache::config('_cake_model_', array(
    'engine' => $engine,
    'prefix' => 'cake_model_',
    'path' => CACHE . 'models' . DS,
    'serialize' => ($engine === 'File'),
    'duration' => $duration,
    'mask' => 0666
));

但它没有改变任何东西。

有人知道我需要更改哪些权限吗?需要更改全新安装的权限是否正常?(除了 app/tmp 我知道这很正常)

4

3 回答 3

2

中的文件app/tmp是用mode 664创建的,因此属于www-data(或运行 Apache 的)的用户可以更改它们。

所以运行:

sudo adduser mich www-data
newgrp www-data

为我解决了这个问题。

高温高压

于 2013-10-10T12:34:58.013 回答
1

sudo chown -R DevinCrossman:www-data .在虚拟主机的根目录中创建整个蛋糕目录的所有权 DevinCrossman:www-data 。

网络服务器(www-data 的成员)需要能够在 app/tmp 中写入

于 2013-07-16T20:37:16.240 回答
0

也许也应该

sudo adduser www-data mich

以便 www-data 可以访问 mich 创建的缓存文件

于 2017-08-16T16:46:02.587 回答