Laravel Error: The stream or file storage/logs/laravel.log could not be opened (Permission denied)

Web server user (`www-data`) lacks write permission on `storage/` or `bootstrap/cache/`.

Runs locally in browser Free · No login Independently Verified 2026-11-25 v4.1.0
Identifier: Laravel Error Platform: PHP
Common Root Causes:
  • Web server user (`www-data`) lacks write permission on `storage/` or `bootstrap/cache/`.

Interactive Diagnostic Checklist

Verified Solutions:
  1. Set `chown -R www-data:www-data storage bootstrap/cache && chmod -R ug+rwX storage bootstrap/cache`.
Safe Diagnostic Command:
ls -ld storage storage/logs bootstrap/cache
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.

Technical Explanation

Web server user (`www-data`) lacks write permission on `storage/` or `bootstrap/cache/`. Recommended diagnostic: `ls -ld storage storage/logs bootstrap/cache`. Remediation: Set `chown -R www-data:www-data storage bootstrap/cache && chmod -R ug+rwX storage bootstrap/cache`.

Worked Examples

  • Run `ls -ld storage storage/logs bootstrap/cache` to verify root cause before applying the remediation.

Limitations & Assumptions

  • Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.

Source References & Verification

Resource ID: err-laravel-storage-permission-denied · Independently verified: 2026-11-25

Related Resources