7
votes

When I try to start Laravel artisan on a Command-line using php artisan serve, it works because I get the "Laravel development server started on http://localhost:8000/".

However, when I try to run 'localhost:8000' on my web browser, I get this 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\laravel\laravel/server.php' (include_path='.;C:\xampp\php\PEAR') in Unknown on line 0"

5

5 Answers

6
votes

In your project folder, the server.php file is missing so you got this error

The solution will to create another project then copy the newly created server.php this will solve it.

Another Solution is:

  1. Open the link: https://github.com/laravel/laravel/blob/master/server.php
  2. Copy all code
  3. Open Notepad and paste your copy code
  4. save Notepad file and set name server.php
  5. 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 the Laravel project will work properly.

0
votes

Try changing your port to 8080. Maybe some other app is already in charge of port 8000 aka port in use.

0
votes

I also face that problem and after quite a time I become to solve it. it very simple to solve it.

When I copy an old project to new Laravel 5.6 setups. I face this problem. so you should first install new laravel setup.

copy your previously created project. when you will use php artisan serve. you will see this type of error.

So it's mean in your project folder "server.php" file is missing.

copy this file from other project and paste it your project. it will run. my problem like this which was I facing solve it by this method.

0
votes

There are 2 ways to remove this. FIRST WAY: (1) copy the server.php from your project folder (
c:\xampp\htdocs\laravel\public\server.php) NOTE: laravel is name of my project (2) the file "server.php" which you have copied, paste this file to root folder (c:\xampp\htdocs\laravel)

SECOND WAY: Trying add this file to root project folder https://github.com/laravel/laravel/blob/master/server.php

0
votes

I had the same issue, but it was because of bad configuration file paths.php in Boostrap folder (Laravel 4.2).

This Line, 'public' => DIR.'/../public',

It seems the project i cloned had setup the the root of the project to be public, So i removed 'public' and become

'public' => DIR.'/..', and everything worked fine. I hope this will help somebody.

So i can conclude that, on top of missing server.php file as how others have been suggesting, also Public folder path misconfiguration in Bootstrap paths.php or app.php for higher Laravel can result into that error.