Laravel 5 crashed after working for a while. Here's the error:
file_put_contents(/Library/WebServer/Documents/project/vendor/services.json):
failed to open stream: Permission denied
in Filesystem.php line 74
I wonder why it's trying to write to the vendor directory?
(See update below!)
Some storage files used for caching were moved to a different location for Laravel v5.0.15.
Affected files:
- services.json
- compiled.php
- routes.php
To quote one of the devs:
It makes more sense in vendor. This makes it more clear that the file
is very specifically tied to the installed dependencies.
For more information and a discussion regarding the changes, see this commit.
Update: The maintainers changed this behavior after some discussion.
As of v5.1, all three files will be written to bootstrap/cache
. If you're on v5.0.*, read on:
The vendor directory will not be written to unless it is actually writable.
Additionally, the method useStoragePathForOptimizations(bool)
was added to Illuminate\Foundation\App and can be called from bootstrap/app.php. This sets the property $useStoragePathForOptimizations
and determines whether the storage directory should be used for optimizations.
See the following two commits for more information:
- Only use vendor if it is writable
- Allow forcing of storage directory for opts