The bootstrap/cache directory must be present and writable Laravel Origin: Application & API Last updated 4 Nov 2026

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.

Exact message you may see 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
Seen on: Laravel PHP Linux

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

  1. mkdir -p bootstrap/cache && chmod -R 775 bootstrap/cache storage
  2. chown -R www-data:www-data bootstrap/cache storage
  3. Run artisan as the web user

Detailed fix by platform

Linux

  1. sudo chown -R www-data:www-data storage bootstrap/cache && sudo chmod -R ug+rwX storage bootstrap/cache

How to diagnose

  1. Folder — Exists?
  2. Owner — Web user?
  3. 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:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

404 on all routes except home (public folder / .htaccess) — Laravel on shared hosting: homepage works but every other route returns 404 Not Found (Laravel)404 on all routes exc…503 Service Unavailable (maintenance mode stuck) — Laravel: Be right back. / 503 Service Unavailable after php artisan down (Laravel)503 Service Unavailab…avc: denied — SELinux is preventing ... / avc: denied { read } for pid=... (permission denied despite correct permissions) (Linux)avc: deniedKey path oauth-private.key does not exist or is not readable — Laravel Passport: LogicException: Key path "file:///var/www/storage/oauth-private.key" does not exist or is not readable (Laravel)Key path oauth-privat…Laravel storage — Laravel: The stream or file "storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied (PHP)Laravel storageLaravel: Allowed memory size exhausted (request) — Laravel/PHP: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in vendor/laravel/framework (Laravel)Laravel: Allowed memo…Not allowed — WordPress: Sorry, you are not allowed to access this page. (WordPress)Not allowedsession save path — Warning: session_start(): open(/var/lib/php/sessions/sess_x, O_RDWR) failed: Permission denied (PHP)session save pathThe boots…

Explore the map of this error Full error map →

🧠 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.