Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

onurzdgn's avatar

Please provide a valid cache path.

Laravel return me Please provide a valid cache path. error. From vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php:36

0 likes
6 replies
tisuchi's avatar

@onurzdgn Create the following directory if not available.

mkdir -p storage/framework/views
mkdir -p storage/framework/sessions
mkdir -p storage/framework/cache/data

And also make sure the right permission for them:

chmod -R 755 storage
chmod -R 755 bootstrap/cache
1 like
onurzdgn's avatar

@tisuchi this time it gives error file_put_contents(/var/www/html/laravelBA/storage/framework/sessions/90a2smrOFY783UCJ969GNdhyP6BYBxyn38H2lCQn): failed to open stream: Permission denied but my session is empty

tisuchi's avatar

@onurzdgn

failed to open stream: Permission denied

You don't have the right permission.

BTW, it seems you are dealing on the server (not locally). In that case, make sure the user has the right permission.

BTW, if you have right permission, try clearing the cache also:

php artisan view:clear
php artisan config:clear
tisuchi's avatar

@onurzdgn

i give 777 and it fixed but I am not sure is it true way

It can be a temporary solution. But giving 777 permissions makes the directory and its contents readable, writable, and executable by everyone which can pose serious security risks.

Surely for long term, this could be my opinion:

  • Set the ownership to the web server user:
chown -R www-data:www-data storage
chown -R www-data:www-data bootstrap/cache
  • Set the permissions to allow the owner to read, write, and execute, and others to read and execute:
chmod -R 755 storage
chmod -R 755 bootstrap/cache

Please or to participate in this conversation.