首页 > 解决方案 > Artisan serve doesn't work and it deletes server.php

问题描述

I have just install xampp and laravel and when I create a new Laravel project, and run php artisan serve, after a few seconds the server quits, and if I rerun it and go to 127.0.0.1, it gives me the error:

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'C:\xampp\htdocs\new_project\server.php' (include_path='C:\xampp\php\PEAR') in Unknown on line 0

And it's deleted the server.php file in the new project.

标签: phplaravelserver

解决方案


php artisan:serve 将在 127.0.0.1:8000 上托管应用程序

您可以在C:\xampp\apache\conf\extra\httpd-vhosts.conf中创建一个虚拟主机。

<VirtualHost myproject.test:80>
  DocumentRoot "C:\xampp\htdocs\myproject\public"
  <Directory "C:\xampp\htdocs\myproject">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
  </Directory>
</VirtualHost>

并编辑您的主机文件 C:\Windows\System32\drivers\etc

添加以下行:127.0.0.1 myproject.test


推荐阅读