LoginSignup
6
8

More than 5 years have passed since last update.

MacのVagrant上のLaravel5が500 Errorになる。

Posted at

Mac Vagrant Laravelで詰まる

会社でMacをもらったので、ニヤニヤしながらLaravelを入れてみたところ500Error。
最初はNginx側の問題だろうと思っていて、confを大分いじってみるもダメ。

そういえばちゃんとエラー見なおそうと思って、見なおしてみたところ

2016/04/27 11:23:28 [error] 6326#6326: *89 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught UnexpectedValueException: The stream or file "/var/www/laravel/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/laravel/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:97

/var/www/laravel/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in ...

どうやらlaravel.logを書き込む権限がないみたいなので、chownとかいろいろやってみるとダメで結構詰まった。

答え

Windowsでは特に困らなかった気がするが、MacだとVagrantfile上の共有フォルダ部分で権限をもたせる必要があるらしい。

なので、

vim Vagrantfile

追記

config.vm.synced_folder ".", "/vagrant"
↓
config.vm.synced_folder ".", "/vagrant", mount_options: ['dmode=777','fmode=755']

共有フォルダにmount_optionsで権限を設定してあげたら動きました!

6
8
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
6
8