Laravel storage PHP Origin: Application & API Last updated 12 Oct 2026

Laravel: The stream or file "storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied

The web server can’t write to Laravel’s storage or bootstrap/cache directories.

Exact message you may see could not be opened in append modeFailed to open stream: Permission denied
Seen on: PHP

Meaning

Laravel writes logs, compiled views, sessions and cache to storage/ and bootstrap/cache. Files created by a different user (deploying or running artisan as root) leave them unwritable for the web server.

Common causes

  • storage/ owned by root after running artisan with sudo
  • Deploy user differs from PHP-FPM user
  • SELinux context

⚡ Quick fix

  1. sudo chown -R www-data:www-data storage bootstrap/cache
  2. chmod -R ug+rw storage bootstrap/cache
  3. Run artisan as the web user: sudo -u www-data php artisan …

Detailed fix by platform

Linux

  1. SELinux: chcon -R -t httpd_sys_rw_content_t storage bootstrap/cache

How to diagnose

  1. Owner — ls -l storage/logs
  2. User — Which user runs PHP-FPM?

🔧 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):

419 Page Expired — Laravel: 419 Page Expired (CSRF token mismatch) (PHP)419 Page ExpiredAADSTS65001 — AADSTS65001: The user or administrator has not consented to use the application (Azure)AADSTS65001Access to the path is denied — System.UnauthorizedAccessException: Access to the path 'x' is denied (.NET)Access to the path is…AccessControlListNotSupported — AccessControlListNotSupported: The bucket does not allow ACLs (AWS)AccessControlListNotS…Command "x" is not defined — Laravel: Symfony\Component\Console\Exception\CommandNotFoundException: Command "make:livewire" is not defined. Did you mean one of these? (Laravel)Command "x" is not de…EACCES — Linux: Permission denied (Linux)EACCESexec permission denied — exec /entrypoint.sh: permission denied (container won't start) (Docker)exec permission deniedfailed to open stream — Warning: include(x.php): Failed to open stream: No such file or directory (PHP)failed to open streamLaravel s…

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.