Wednesday, September 30, 2020

Doctrine/DBAL/Driver/PDO/Exception with message 'SQLSTATE[HY000] [2002] Connection refused'

on a new laravel project, I was trying to use php artisan migrate and get an error message: 
Doctrine/DBAL/Driver/PDO/Exception with message 'SQLSTATE[HY000] [2002] Connection refused'

and then tried to use 
php artisan tinker
DB::connection()->getPdo();
get the same error message: 

Doctrine/DBAL/Driver/PDO/Exception with message 'SQLSTATE[HY000] [2002] Connection refused'


solution:

go to .env

change the 

DB_HOST=127.0.0.1
 
to

DB_HOST=localhost

Wednesday, April 15, 2020

Starting The Scheduler

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1 Starting The Scheduler When using the scheduler, you only need to add the following Cron entry to your server. If you do not know how to add Cron entries to your server, consider using a service such as Laravel Forge which can manage the Cron entries for you: * * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1 This Cron will call the Laravel command scheduler every minute. When the schedule:run command is executed, Laravel will evaluate your scheduled tasks and runs the tasks that are due. https://laravel.com/docs/6.x/scheduling#background-tasks