Laravel: RuntimeException: The /var/www/bootstrap/cache directory must be present and writable.
Laravel can't write its compiled cache files because the folder is missing or has the wrong permissions/owner.
The bootstrap/cache directory must be present and writableRuntimeException: The /var/www/html/bootstrap/cache directory must be present and writablebootstrap/cache must be present and writableUnable to create bootstrap cache directory Meaning
The web server user (www-data, nginx, apache) must write bootstrap/cache and storage. Create the folder if missing, set ownership/permissions (775), and avoid running artisan as root which creates root-owned cache files. SELinux contexts can also block writes.
Common causes
- Folder missing after deploy (git-ignored)
- Wrong owner or permissions
- Artisan run as root created root-owned files
- SELinux denying writes
- Read-only filesystem/container
⚡ Quick fix
mkdir -p bootstrap/cache && chmod -R 775 bootstrap/cache storagechown -R www-data:www-data bootstrap/cache storage- Run artisan as the web user
Detailed fix by platform
Linux
sudo chown -R www-data:www-data storage bootstrap/cache && sudo chmod -R ug+rwX storage bootstrap/cache
How to diagnose
- Folder — Exists?
- Owner — Web user?
- SELinux — Context ok?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- 404 on all routes except home (public folder / .htaccess) Laravel on shared hosting: homepage works but every other route returns 404 Not Found
- 503 Service Unavailable (maintenance mode stuck) Laravel: Be right back. / 503 Service Unavailable after php artisan down
- avc: denied SELinux is preventing ... / avc: denied { read } for pid=... (permission denied despite correct permissions)
Most viewed in Laravel
- MassAssignmentException Laravel: Illuminate\Database\Eloquent\MassAssignmentException: Add [x] to fillable property to allow mass assignment
- The GET method is not supported for route Laravel: The GET method is not supported for route x. Supported methods: POST (MethodNotAllowedHttpException)
- Route [login] not defined Laravel: Symfony\Component\Routing\Exception\RouteNotFoundException: Route [login] not defined
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 4 Nov 2026