Vagrant + CakePHP + CentOS 7.1でうまく表示されない問題
VagrantでCakePHPをComposerからインストールしてローカル開発環境を作成しようと思っていたところ、以下と同じ状況になってしまい
CakePHP cache was unable to write in Centos 7
AWSのEC2にCakePHP2.6を導入したのですがエラーが消えません。
ファイルの権限をchmod 777 -R temp
と変更してみましたがエラーが消えません。
Uncaught exception 'CacheException' with message
'Cache engine "_cake_core_" is not properly configured.
Ensure required extensions are installed, and credentials/permissions are correct' in /webroot/hoge/Vendor/cakephp/cakephp/lib/Cake/Cache/Cache.php:186
Stack trace:
#0 /webroot/hoge/Vendor/cakephp/cakephp/lib/Cake/Cache/Cache.php(151): Cache::_buildEngine('_cake_core_')
#1 /webroot/hoge/App/Config/core.php(354): Cache::config('_cake_core_', Array)
#2 /webroot/hoge/Vendor/cakephp/cakephp/lib/Cake/Core/Configure.php(72): include('/webroot/hoge...')
#3 /webroot/hoge/Vendor/cakephp/cakephp/lib/Cake/bootstrap.php(431): Configure::bootstrap(true)
#4 /webroot/hoge/App/webroot/index.php(98): include('/webroot/hoge...')
#5 {main}
thrown in /webroot/hoge/Vendor/cakephp/cakephp/lib/Cake/Cache/Cache.php on line 186
開発環境は
- centOS 7.1
- CakePHP 2.X
ほとんどの場合chmodで回避できた方が多い様ですが、私の場合は何か違う所が問題なのかもしれないのでどなたか同じ状況で解決策をご存知の方がいらっしゃいましたらご教授願います。
追記:以下の設定で環境構築をしています。
Vagratnfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.define "hoge" do |node|
node.vm.box = "bento/centos-7.1"
node.vm.hostname = "hoge"
node.vm.network :private_network, ip: "192.168.33.61"
node.vm.network :public_network, ip: "192.168.11.61"
node.vm.provision "ansible" do |ansible|
ansible.playbook = "playbook.yml"
end
node.vm.synced_folder "./webroot", "/webroot", type: "nfs", mount_options: ["async", "nolock", "nfsvers=3", "vers=3", "tcp", "noatime", "soft", "rsize=8192", "wsize=8192"]
end
end
composer.json ファイル
{
"name": "hoge",
"repositories": [
{
"type": "pear",
"url": "http://pear.cakephp.org"
}
],
"require": {
"cakephp/cakephp": ">=2.4.9",
"cakedc/search": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "3.7.*",
"cakephp/debug_kit" : "2.2.*"
},
"config": {
"vendor-dir": "Vendor/"
}
}
core.php
Cache::config('_cake_core_', array(
'engine' => $engine,
'prefix' => $prefix . 'cake_core_',
'path' => CACHE . 'persistent' . DS,
'serialize' => ($engine === 'File'),
'duration' => $duration,
'mask' => 0777,
));
Cache::config('_cake_model_', array(
'engine' => $engine,
'prefix' => $prefix . 'cake_model_',
'path' => CACHE . 'models' . DS,
'serialize' => ($engine === 'File'),
'duration' => $duration,
'mask' => 0777,
));