That error means the current user (probably root
or www-data
) doesn’t have write permissions to the Laravel storage
directory or its subfolders.
🔧 Fix File Permissions
Run these commands to give proper ownership and permissions:
1. Give the web server user access (assuming you’re using Apache or Nginx)
cd /var/www/html/million-candles/backend
# Set correct ownership (adjust 'www-data' if your web server uses a different user)
sudo chown -R www-data:www-data storage bootstrap/cache
# Give read/write/execute permission to owner
sudo chmod -R 775 storage bootstrap/cache
If you’re running commands as
root
, and Laravel is executed viawww-data
, this ensures the app can write to the necessary folders.
✅ Recommended .gitignore
reminder
Make sure storage
contents like cache, logs, and sessions are ignored in Git:
/storage/*
!/storage/.gitignore
!/storage/framework/
/storage/framework/cache/*
!/storage/framework/cache/.gitignore
After Fixing Permissions
You can now retry the failed Git commands or run Laravel normally:
php artisan config:cache
php artisan route:cache
Let me know if your Laravel app is running on a different user or if you’d like to reset the file permissions entirely.