LoginSignup
64
64

More than 5 years have passed since last update.

VagrantでCakePHPを動かそうとした際に躓いたこと

Posted at

CakePHPセットアップ時によくあるエラー

CakePHPセットアップ時にapp/tmpの権限がうまく言っていないと下記のエラーが出てしまいます。

Warning: _cake_core_ cache was unable to write 'cake_dev_ja' to File cache in /vagrant/lib/Cake/Cache/Cache.php on line 325

Warning: /vagrant/app/tmp/cache/persistent/ is not writable in /vagrant/lib/Cake/Cache/Engine/FileEngine.php on line 386

Fatal error: Uncaught exception 'CacheException' with message 'Cache engine _cake_core_ is not properly configured.' in /vagrant/lib/Cake/Cache/Cache.php:181 Stack trace: #0 /vagrant/lib/Cake/Cache/Cache.php(151): Cache::_buildEngine('_cake_core_') #1 /vagrant/app/Config/core.php(367): Cache::config('_cake_core_', Array) #2 /vagrant/lib/Cake/Core/Configure.php(72): include('/vagrant/app/Co...') #3 /vagrant/lib/Cake/bootstrap.php(177): Configure::bootstrap(true) #4 /vagrant/app/webroot/index.php(92): include('/vagrant/lib/Ca...') #5 {main} thrown in /vagrant/lib/Cake/Cache/Cache.php on line 181

app/tmpのパーミッションを777にして実行権限をapacheにも与えてあげる必要があります。

Vagrantでのファイルパーミッション設定方法

Vagrantのファイルパーミッションはコマンドで直接変更ができないようになっているようで、upする際にパーミッションを決めて上げる必要があるみたいです。

Vagrantfileに下記のコードを追記してグループ権限をapacheにしてあげれば上記のエラーは解決されます。(Chefなどでapache入れてる前提)

config.vm.synced_folder "./", "/vagrant", owner: 'vagrant', group: 'apache', mount_options: ['dmode=777', 'fmode=666']

ちょっと躓いたのでメモ。

64
64
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
64
64