laravel 5.4 php artisan 服务无效请求(意外的 EOF)

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

laravel 5.4 php artisan serve Invalid request (Unexpected EOF)

phplaravel

提问by designerdarpan

I am using windows 10 and wamp server and I am fresh installing laravel and all i get is this error message and is it necessary to do php artisan serve everytime i open laravel ? as long as i close cmd prompt localhost:8000 refused to connect .

我正在使用 Windows 10 和 wamp 服务器,我刚刚安装 laravel,我得到的只是这个错误消息,每次打开 laravel 时是否有必要执行 php artisan serve?只要我关闭 cmd 提示 localhost:8000 拒绝连接。

Php artisan serve errorPhp artisan serve error

Php工匠服务错误Php工匠服务错误

回答by Awolad Hossain

I think you are running a Laravel project blogby command php artisan serveand you are browsing your application by localhost:8000 or 127.0.0.1:8000

我认为您正在通过命令php artisan serve运行 Laravel 项目博客,并且您正在通过 localhost:8000 或 127.0.0.1:8000 浏览您的应用程序

Your screenshot saying that when you are trying to visit a url which is not defined in your routes/web.php then, you are getting invalid request (Unexpected EOF)error in your cmd.

您的屏幕截图显示,当您尝试访问未在 routes/web.php 中定义的 url 时,您的 cmd会收到无效请求(意外 EOF)错误。

And of course! in this case when you close cmd then your Laravel app will not run.

而且当然!在这种情况下,当您关闭 cmd 时,您的 Laravel 应用程序将不会运行。

So now, if you don't want to run your Laravel app by the following command each time, then you can use Laragonin windows environment.

所以现在,如果你不想每次都通过以下命令运行你的 Laravel 应用程序,那么你可以 在 windows 环境中使用Laragon

回答by Mehrud

Either you have to run php aritsan serveor set up a virtual host in your OS. Here is how to set up a virtual host in Ubuntu 16.04: How To Set Up Apache Virtual Hosts on Ubuntu 16.04

您必须php aritsan serve在操作系统中运行或设置虚拟主机。以下是在 Ubuntu 16.04 中设置虚拟主机的方法如何在 Ubuntu 16.04 上设置 Apache 虚拟主机

回答by Pankaj Sharma

This is case, you can keep your cmdopen. And open another cmd, redirect to file path where you are working and it should work fine.

在这种情况下,您可以保持cmd开放。并打开另一个cmd,重定向到您正在工作的文件路径,它应该可以正常工作。