kramer65
kramer65

Reputation: 53923

Laravel put contents in php file?

I've got an error in a Laravel instance, which says:

[2016-11-08 16:48:19] prod.ERROR: ErrorException: file_put_contents(/theLaravelSite/bootstrap/cache/services.php): failed to open stream: Permission denied in /theLaravelSite/bootstrap/cache/compiled.php:7327

I've seen these errors before, which relate to the storage folder, but I'm a bit confused by this one, since it seems to say that it tries to write content to bootstrap/cache/services.php.

Any idea how I can solve this?

Upvotes: 2

Views: 140

Answers (2)

Saumya Rastogi
Saumya Rastogi

Reputation: 13699

Change the directory permissions to:

chmod -R 775 storage/
chmod -R 775 bootstrap/cache/

According to Laravel Docs

After installing Laravel, you may need to configure some permissions. Directories within the storage and the bootstrap/cache directories should be writable by your web server or Laravel will not run. If you are using the Homestead virtual machine, these permissions should already be set.

Upvotes: 3

Alexey Mezenin
Alexey Mezenin

Reputation: 163898

You should set correct permissions on bootstrap folder recursively:

chmod -R 775 bootstrap

Also, check if bootstrap/cache exists. If it doesn't exist, create it manually.

Upvotes: 2

Related Questions