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.
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
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 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026