Search code examples
phplaravellaravel-5portlaravel-artisan

How can I kill the current php artisan serve session before starting a new one?


I often find myself open up so many ports when running php artisan serve

Laravel development server started: <http://127.0.0.1:8000>
[Thu Dec  2 19:56:23 2021] Failed to listen on 127.0.0.1:8000 (reason: Address already in use)
Laravel development server started: <http://127.0.0.1:8001>
[Thu Dec  2 19:56:23 2021] Failed to listen on 127.0.0.1:8001 (reason: Address already in use)
Laravel development server started: <http://127.0.0.1:8002>
[Thu Dec  2 19:56:23 2021] Failed to listen on 127.0.0.1:8002 (reason: Address already in use)
Laravel development server started: <http://127.0.0.1:8003>

Is there away to kill http://127.0.0.1:8000 before starting a new one ?

so my application will be at http://127.0.0.1:8000...

Any hint for on how to do that ?


Solution

  • I think you can close the terminal, and then the port automatically gets killed.

    But if that does not work, you can kill the process manually by running this command :

    kill $(lsof -t -i:8000)