php - 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.
- Windows 10
- Laravel 5.8.34
- PHP 7.3.8
Composer 1.9.0
ps : i haven't any antivirus installed
解决方案
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
推荐阅读
- haskell - 对卡片列表进行排序
- sql - SQL 根据同一列中的其他值过滤值
- sas-metadata - 以编程方式创建一个具有内部登录的新人员
- ios - 带有图像和裁剪视图的 APNS
- zenoss - 如何使用 zendmd 在 Zenoss 中重置密码(或解锁用户)?(通常的方法不起作用)
- wordpress - 当我使用 facebook 页面插件小部件时,出现错误
- android - 范围报告问题并行测试
- oracle - Oracle PL/SQL 触发器(插入新行时触发)
- python - 从 csv 文件读取和写入 np 数组的问题
- rest - 向所有骆驼restlet路由添加通用身份验证标头