使用命令行界面停止 Laravel 服务器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38761354/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Stop laravel server with command line interface
提问by Nandakumar
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.
我只是尝试在 shell 脚本中自动化 Laravel 进程,如(开始,停止)。为了启动 Laravel 服务器,我在 shell 文件中使用了 php artisan serve。
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.
我试图使用命令停止 laravel 服务器。但我很奇怪,我没有看到任何停止服务器的命令。我曾经使用 Ctl+C 来停止服务器或关闭命令提示符。
1.Any laravel commands to stop the server ?
1.任何停止服务器的laravel命令?
- I have started the laravel server using shell file, which exits after starting.
- 我已经使用 shell 文件启动了 laravel 服务器,该文件在启动后退出。
How can I stop them now ? I dont have any command prompts running this process to exit the server.
我现在怎样才能阻止他们?我没有任何命令提示符运行此进程来退出服务器。
回答by sumit
You can kill the port
你可以杀死端口
sudo kill $(sudo lsof -t -i:port_number)
Like if it is running on 8000, you can do below
就像它在 8000 上运行一样,你可以在下面做
sudo kill $(sudo lsof -t -i:8000)
回答by Jared Eitnier
You could write your own command to execute a script to locate and kill the process.
您可以编写自己的命令来执行脚本来定位和终止进程。
You could also ssh into the server and restart php.
您也可以 ssh 进入服务器并重新启动 php。
You could additionally ssh into the server and manually find the process and kill it.
您还可以通过 ssh 进入服务器并手动查找进程并终止它。
回答by Ricardo Castillo
Easier and you can view all processes about artisan :)
更容易,您可以查看有关工匠的所有流程:)
ps aux | grep artisan or ps -aux | grep artisan
kill 'PID NUMBER'
回答by Hassan Elshazly Eida
Try:
尝试:
killall -9 php
killall -9 php
Or Start new port
或启动新端口
php artisan serv 8001
php工匠服务8001