在laravel中恢复'php artisan serve'命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23932127/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 17:03:36  来源:igfitidea点击:

revert 'php artisan serve' command in laravel

phpapachecommand-linelaravel

提问by halkujabra

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:8000ie., I want it not to serve now.

我有一个 Laravel 应用程序。我运行'php artisan serve'命令进行本地测试,我的应用程序在localhost:8000 上提供服务。但是现在我想停止在localhost:8000 上提供服务,即,我希望它现在不提供服务。

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.

注意:我使用 Windows 进行测试。

回答by Mohammed Omer

here is what i do press ctrl+ c

这是我所做的按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

检查端口是否繁忙,如果有任何进程正在侦听端口 8000,它将显示端口 id

> sudo  kill -9 [PID]

kill the process that listen to that port id

杀死监听那个端口号的进程

run lsof agin

运行 lsof gin

> sudo lsof -i 8000

vola

沃拉

回答by jsalonen

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

Ctrl+ Shift+ ESC。找到运行 artisan 的 php 进程并右键单击->杀死它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.

请注意,您应该能够通过使用Ctrl+向其发送终止信号来终止该进程C

回答by David Noleto

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

我在我的 mac 中使用Ctrl+C来停止命令 php artisan laravel serve

回答by T-Bee

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

对于 Windows 用户,键入此命令以显示当前正在运行的 php artisan 进程列表:

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:

查找 PID 号 (XXXX),然后键入以下内容以终止进程:

taskkill /F /PID XXXX

回答by mareq133

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

带有 XAMPP 服务器的 Windows 10 取决于您用来运行的 shell:

php artisan serve

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

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

在 Windows CMD 中:CTRL+C
在 XAMPP Shell 中:CTRL+Pause/Break

在 Ubuntu 和 RedHat/CentOS 终端中:CTRL+C

回答by Deepanjan Bhattacharyya

Ctrl+ Pause|Breakshould do it for Windows.

Ctrl+Pause|Break应该为 Windows 做。

回答by Jay LampStack

If your using VS Code, simply do the following:

如果您使用 VS Code,只需执行以下操作:

  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
  1. 打开 VS Code 终端
  2. 找到显示所有正在运行的 shell 列表的下拉框
  3. 从列表中选择“php”,然后单击垃圾箱图标

This deletes the shell and kills the server.

这将删除外壳并杀死服务器。

回答by user1506104

When I use cygwinto run my php artisan serveon Windows machine, pressing ctrl+ cdoes not kill the process. To stop it, use @jsalonen's solution. Basically you are looking for this then kill it:

当我使用cygwinphp artisan serve在 Windows 机器上运行我的机器时,按ctrl+c不会终止该进程。要阻止它,请使用@jsalonen 的解决方案。基本上你正在寻找这个然后杀死它:

enter image description here

在此处输入图片说明