Nandakumar
Nandakumar

Reputation: 1101

Stop laravel server with command line interface

I just tried to automate the laravel process like(Start, Stop) in shell scripts. To start the laravel server, I use php artisan serve in the shell file.

I tried to stop the laravel server using command. But I was wonder, I didnt see any commands to stop the server. I used to Ctl+C to stop the server or to close the command prompt.

1.Any laravel commands to stop the server ?

  1. I have started the laravel server using shell file, which exits after starting.

How can I stop them now ? I dont have any command prompts running this process to exit the server.

Upvotes: 17

Views: 98241

Answers (3)

sumit
sumit

Reputation: 15464

You can kill the port

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

Like if it is running on 8000, you can do below

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

If above not worked (because frozen or unresponsive process may not respond), add parameter -9 to kill command like this:

sudo kill -9 $(sudo lsof -t -i:8000)

Upvotes: 70

Ricardo Castillo
Ricardo Castillo

Reputation: 381

Easier and you can view all processes about artisan :)

ps aux | grep artisan
# get the PID from the list
kill <PID NUMBER>

Upvotes: 6

Hessam Bozorgzad
Hessam Bozorgzad

Reputation: 19

Try killall -9 php Then sudo kill $(sudo lsof -t -i:8000) Then php artisan serve

Upvotes: 1

Related Questions