简体   繁体   中英

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 will host the application on 127.0.0.1:8000

You can create a virtual host in 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>

And also edit your hosts file C:\\Windows\\System32\\drivers\\etc

Add the following line: 127.0.0.1 myproject.test

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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