简体   繁体   English

为什么我不能使用 PHP artisan serve 运行我的 Laravel 应用程序?

[英]Why can't I run my laravel app with PHP artisan serve?

I'm working on a laravel app.我正在开发一个 Laravel 应用程序。 I made the simple installation of a new laravel app, and in the previous days it was running great.我简单地安装了一个新的 Laravel 应用程序,在前几天它运行良好。

But now I'm not able to access my project in browser after running php artisan serve.但是现在我无法在运行 php artisan serve 后在浏览器中访问我的项目。 The browser just says page not found and the buffering of that page is like infinite.浏览器只是说找不到页面,该页面的缓冲就像是无限的。

I tried to run the server in a different port with:我尝试在不同的端口上运行服务器:

php artisan serve --port=9000

and then accessed it in http://127.0.0.1:9000/然后在http://127.0.0.1:9000/访问

It run well once, but then it stopped again.它运行了一次,但后来又停止了。

It didn't work for me but I used composer:它对我不起作用,但我使用了作曲家:

php artisan serve --port=9000 

Then it hanged.然后就挂了。 I press CTRL + C and I got it working without any errors我按CTRL + C并且我让它正常工作,没有任何错误

You could try out the following:您可以尝试以下方法:

  • php -S localhost:8000 -t public To run withe inbuilt PHP server php -S localhost:8000 -t public使用内置 PHP 服务器运行
  • Make a fresh installation of a laravel project and copy your files into it.重新安装一个 Laravel 项目并将您的文件复制到其中。

Try this, I got solved by these;试试这个,我被这些解决了;

1) Change the default url to like this - localhost/<your-project-name>/public/ instead of default one 127.0.0.1:8000 1) 将默认 url 更改为这样 - localhost/<your-project-name>/public/而不是默认的127.0.0.1:8000

or或者

2) use this php -S localhost:8000 -t public or php -S 127.0.0.1:8000 -t public 2) 使用这个php -S localhost:8000 -t publicphp -S 127.0.0.1:8000 -t public

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM