9

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?

1
  • 2
    php artisan cache:clear Commented Jul 29, 2015 at 11:42

2 Answers 2

18

Try this artisan command

php artisan cache:clear 
Sign up to request clarification or add additional context in comments.

1 Comment

wow, i dont know what happened but it worked! although i was setting up Form Facade when i encountered this issue.
9

(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:

1 Comment

@ajay23romu, you have two options: 1) Upgrade to Laravel 5.1 which uses the bootstrap/cache directory to store cache files. Make sure this directory is writable. Or 2) Edit bootstrap/app.php and add this line: $app->useStoragePathForOptimizations(true); Then make sure the directory storage/framework is writable. However, it's recommended to upgrade to Laravel 5.1 which is a "Long Term Support" release.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.