php
Database connection refused
Illuminate\\Database\\QueryException.*SQLSTATE\[HY000\].*Connection refused
Fixes
- 1.Verify database service is running
- 2.Check .env DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD
- 3.For Docker: use container name as host, not localhost
- 4.Clear config cache: php artisan config:clear after .env changes
databaseconnection
Related Errors
php4 fixes
Undefined variable used
Undefined variable.*\$
- •Initialize the variable before use
- •Check for typos in the variable name
php4 fixes
PHP class not found
Class ['"].*['"] not found
- •Run composer dump-autoload to regenerate autoload files
- •Check namespace matches directory structure (PSR-4)
php3 fixes
Database table does not exist
SQLSTATE\[42S02\].*Table.*doesn't exist
- •Run php artisan migrate to create the table
- •Check table name in migration matches what the model expects