Strange behavior on stopping php artisan serve

523 views laravel
2

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 local host database of pgsql and dont 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.

answered question

make sure other laravel app is not running on 127.0.0.1:8000

2 Answers

13

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

posted this
13

This happens 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:

Solution

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

posted this

Have an answer?

JD

Please login first before posting an answer.