Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 537
Nandakumar Avatar asked Aug 04 '16 07:08

Nandakumar


People also ask

How do I shut down Laravel server?

“stop laravel server” Code Answer's and press ctrl+c. It will stop your server.

How do I stop php artisan serve in CMD?

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.

How do I turn off Laravel?

How to stop laravel server? Well you have started your laravel server successfully now you want to stop server. To execute php artisan serve stop simply goto your commnad line where your server is running and press ctrl+c. It will stop your server.

How do I stop a php serve?

Press the (X) button on the top right(on Windows/Linux)/Press the red color circle on the top left(on Mac OS) of the terminal window to stop the PHP server from running.


2 Answers

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)
like image 151
sumit Avatar answered Sep 18 '22 08:09

sumit


Easier and you can view all processes about artisan :)

ps aux | grep artisan
# get the PID from the list
kill <PID NUMBER>
like image 24
Ricardo Castillo Avatar answered Sep 21 '22 08:09

Ricardo Castillo