7

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 Answers 5

8

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.

Sign up to request clarification or add additional context in comments.

1 Comment

this works for me, but doubt why it happened as it is supposed to come out of the box in the first place
0

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

2 Comments

I have changed it- "php artisan serve --port=8080" but it does not work.
0

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.

1 Comment

Welcome to SO! This seems to remove the symptoms (I don't know what causes this problem - some "virus protection" seem to dislike this "server.php"). (Can you get help with your English? Using a spelling checker only addresses part of that.)
0

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

1 Comment

Do not put links to code in your answer. Links go dead over time and make your answer worthless. stackoverflow.com/help/how-to-answer
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.