Framework: Storage path path not working in laravel 5

Created on 6 Feb 2015  路  20Comments  路  Source: laravel/framework

I'm clone laravel 5 project from my repo run composer update and get error:
file_put_contents(/e59b9a8e34ca54e024d88970cf3bac09): failed to open stream: Permission denied.
Why use path/, why not /storage/framework/views?

Most helpful comment

change name of file config.php to config.php_ in bootstrap/cache/config.php .

All 20 comments

http://laravel.com/docs/5.0/configuration#after-installation

Permissions
Laravel may require one set of permissions to be configured: folders within storage require write access by the web server.

My storage/ folder is ok, laravel somehow requires an entry in /

Oh right.
Try reinstalling composer or sudo composer update?

If i run sudo composer update cache has been write in / and all be ok, but it's wrong way

What a headache... :cry:

This belongs on the forums.

If your project is missing "storage/framework/views" folder, you receive that error. You should create that folder and give sufficient permission to it.

+1 @SalahiAltinci
Same applies to the "storage/framework/sessions" folder... I think that's a bug and laravel should create those folders automatically if they don't exist, instead of taking an empty path and trying to perform "file_put_contets()" on "/".

I've had this problem. The cause is the folder 'storage / framework / views ", this folder is set in config / views.php. This configuration file uses the realpath function (http://php.net/manual/en/function.realpath.php ) to get the absolute path if the folder does not have the appropriate permissions or does not exist, the function returns false.

The result will be: file_put_contents (false "/ e59b9a8e34ca54e024d88970cf3bac09."), Which will cause the error.

Try to fix the permissions in folder (recommended) or change config/views.php in :

From: 'compiled' => realpath(storage_path().'/framework/views')
To: 'compiled' => storage_path().'/framework/views',

+1 @adriano0488 work to me

+1 @adriano0488 . Thank you.

work to me

run sudo ./artisan config:cache in the application root path. not the repo path.

refer to laravel wrong path

To test this you could disable SElinux temporally with the following command:
setenforce 0

Because when you deploy, you push all config from your local to sever so some configuration will not be correct anymore
Run php artisan config:clear
It will be fixed

+1 @minhnguyenaduro . Thank you.

change name of file config.php to config.php_ in bootstrap/cache/config.php .

Thank you sachoingit

run sudo ./artisan config:cache in the application root path. not the repo path.

refer to laravel wrong path

This is very important for those who use vagrant (for example) to run artisan config:cache inside vagrant vm not from the macos terminal or whatever machine you are using

change name of file config.php to config.php_ in bootstrap/cache/config.php .
tanx @sachoingit
it's worked for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Anahkiasen picture Anahkiasen  路  3Comments

shopblocks picture shopblocks  路  3Comments

progmars picture progmars  路  3Comments

kerbylav picture kerbylav  路  3Comments

ghost picture ghost  路  3Comments