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.
could not be opened in append modeFailed to open stream: Permission denied 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
sudo chown -R www-data:www-data storage bootstrap/cachechmod -R ug+rw storage bootstrap/cache- Run artisan as the web user:
sudo -u www-data php artisan …
Detailed fix by platform
Linux
- SELinux:
chcon -R -t httpd_sys_rw_content_t storage bootstrap/cache
How to diagnose
- Owner — ls -l storage/logs
- 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:
Similar errors
Most viewed in PHP
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 12 Oct 2026