26
votes

I have a laravel app. I ran 'php artisan serve' command for local testing and my app was served at localhost:8000. But now I want to stop serving it at localhost:8000 ie., I want it not to serve now.

I closed the command line, restarted the server but it is still serving. How can it be done?

Note: I am using windows for testing purposes.

10
Are you running Windows? - jsalonen
@jsalonen updated the question - halkujabra
u have to stop the server from cmd/terminal before closing it - Saahithyan Vigneswaran
for mac users, try control + C instead of command + C - Fariman Kashani

10 Answers

23
votes

Press Ctrl + Shift + ESC. Locate the php process running artisan and kill it with right click -> kill process.

Reopen the command-line and start back the server.

Note that you should be able to kill the process just by sending it a kill signal with Ctrl + C.

42
votes

here is what i do press ctrl+ c

> lsof -i :8000

to check if the port is busy or not if any process is listening to the port 8000 it will be displayed with port id

> sudo  kill -9 [PID]

kill the process that listen to that port id

run lsof agin

> sudo lsof -i 8000

vola

11
votes

I used Ctrl + C in my mac for stop the command php artisan laravel serve

7
votes

For windows user, type this command for showing the list of current running php artisan process:

tasklist /FI "IMAGENAME eq php.exe"

Will show:

Image Name ---- PID ---- Session Name ---- Session ---- Mem Usage

php.exe --------- XXXX ---- Console ----------  4 ------- 19.852 K

Look up PID number (XXXX), and type this to kill the process:

taskkill /F /PID XXXX
5
votes

When I use cygwin to run my php artisan serve on Windows machine, pressing ctrl + c does not kill the process. To stop it, use @jsalonen's solution. Basically you are looking for this then kill it:

enter image description here

4
votes

Windows 10 with XAMPP server depending on what shell you use to run:

php artisan serve

In Windows CMD: CTRL + C
In XAMPP Shell: CTRL + Pause/Break

In Ubuntu and RedHat/CentOS terminal it's: CTRL + C

3
votes

Ctrl + Pause|Break should do it for Windows.

1
votes

If your using VS Code, simply do the following:

  1. Open VS Code terminal
  2. Find the drop down box that displays a list of all the running shells
  3. Select "php" from the list and click the garbage bin icon

This deletes the shell and kills the server.

1
votes

In Windows CMD or smder: CTRL + C

1
votes

This work for me.

sudo kill $(sudo lsof -t -i:port_number)