The stream or file could not be opened in append mode: failed to open stream: Permission denied

The stream or file could not be opened in append mode: failed to open stream: Permission denied

Storage Permission Error

Step 1: Open your terminal Navigate to your Laravel project root.
For example: cd C:/xampp/htdocs/your-project-name
Step 2: Set the correct folder permissions Run this command to give read, write, and execute permissions to the storage and bootstrap/cache directories: sudo chmod -R 775 storage bootstrap/cache chmod -R 775 sets read, write, and execute permissions for the owner and group, and read/execute for others. -R means recursive, so it applies to all subfolders and files.
Step 3: Set the correct folder ownership Run this command to make the web server user the owner of these folders: sudo chown -R www-data:www-data storage bootstrap/cache www-data is the typical user for Apache/Nginx on Linux. This ensures Laravel can write to these directories without permission issues.
Step 4: Clear Laravel caches (optional but recommended) After fixing permissions,
clear cached files:
php artisan config:clear
php artisan cache:clear
php artisan view:clear
php artisan route:clear
This ensures Laravel uses the new permissions immediately.

✅ Summary Navigate to your project root. Run chmod -R 775 storage bootstrap/cache. Run chown -R www-data:www-data storage bootstrap/cache. Clear Laravel caches. Now, the permission denied error should be resolved, and Laravel can write files to storage and bootstrap/cache.

Back