Reputation: 151
When I change my SQL server from pgsql (localhost) to MySQL (remote host) in the env file
database.php file has this line:
'default' => env('DB_CONNECTION', 'mysql'),
i run:
php artisan serve
and I call my page it does not respond and get stuck
After this, I press CTRL+C and close Laravel.
Then I restart the engine PHP artisan serve, and then I get this error:
Laravel development server started: http://127.0.0.1:8000 [Sun Sep 16 16:05:52 2018] Failed to listen on 127.0.0.1:8000 (reason: Address already in use)
Is there something I am missing.
If I go back to my localhost database of pgsql and don't change the line
'default' => env('DB_CONNECTION', 'mysql'),
in my database.php file it works fine. (it should not because I am using a pgsql database)
I also tried using
php artisan serve --port 3333
but that has given the same behavior.
Upvotes: 2
Views: 2613
Reputation: 5406
Try to clear cached data like config, cache, view.
php artisan config:clear // cache:clear and view:clear
OR
This can happen when there is already an app running on 127.0.0.1:8000
You can close that app then it will work. OR if you want to run multple apps then use shown below way:
php artisan serve --host=127.0.0.1 --port=8888
You can try different host ip as well as port no.s
I suggest you should learn how to make a virtualhost. It will let you hit your local project without running this command and you can also make an alias like dev.app.com etc
Upvotes: 1
Reputation: 2416
Maybe another laravel application is running in this 8000 port. If not, you change the port for this application. like:
php artisan serve --port=8080
Upvotes: 0