Reputation: 63
When I create a new Laravel 5.6 website and use php artisan serve
in the console the website loads in the browser, but when I refresh the page the server.php file deletes itself and I get a page error.
Below is an image of the error message:
This is the text of 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\test3\server.php' (include_path='C:\xampp\php\PEAR') in Unknown on line 0
Upvotes: 0
Views: 4067
Reputation: 10061
server.php
file is missing so you got this error, Some antivirus considers that the server.php file is a virus, So he simply removes it.
You can also manually create server.php file
Open the link and copy all the code: https://github.com/laravel/laravel/blob/master/server.php
save in Notepad file and set name server.php
Copy the server.php file and paste it inside your Laravel project
Run your project again in browser Now you will not get an error and your Laravel project will work properly.
Upvotes: 3
Reputation: 2570
You need to update both composer and laravel installer. This happens maybe you have latest composer version but outdated laravel installer. To do this, run composer update then composer global require "laravel/installer" to update laravel installer as well.
Lastly check the server requirement for your laravel version. Laravel 5.6 requires at least PHP >= 7.1.3. So make sure you have that in your serve. If not then you probably need to update it.
After the updates, try to install laravel again.
EDIT: I confirmed the issue, it seems a bug in laravel installer
The solution will to create another project then copy the newly created server.php this will solve it.
Also if your anti-virus is avast, you need to add exception there, I have a response in GitHub that avast considers it as a threat.
Upvotes: 0