1

初めて Cake コンソール アプリケーションを実行しようとしています。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

のファイルはmodeapp/tmpで作成されるため、所属するユーザー(またはApache が実行されているグループ) はそれらを変更できます。 664www-data

実行中:

sudo adduser mich www-data
newgrp www-data

私のために問題を解決しました。

HTH

于 2013-10-10T12:34:58.013 に答える