Fix this error
Laravel: storage/logs/laravel.log could not be opened: Permission denied
Dasun Kalupahana 197 views
The error
Error
The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied
Why it happens
The web server user (often www-data, nginx or apache) cannot write to storage/ or bootstrap/cache/. This happens after uploading files as another user, running artisan as root, or extracting a zip that kept the wrong permissions.
How to fix it
- Give the web server user ownership of the two writable folders.
- Make them writable for the owner and group (775, not 777).
- On shared hosting (cPanel), set the folders to 755 or 775 in File Manager; files run as your own user there.
sudo chown -R www-data:www-data storage bootstrap/cache
sudo chmod -R 775 storage bootstrap/cache
Learn more on the blog
PostgreSQL vs MySQL Performance: Real Benchmarks Compared
Last updated: 7 November 2026. See the update log at the end."Which...
Secure a Laravel App Before Production: Tested Checklist
Last updated: 8 November 2026. See the update log at the end.Laravel...
How to Detect and Fix PHP Memory Leaks
Last updated: 5 November 2026. See the update log at the end.In...