Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel: Error displaying localhost:8000 on browser

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"

like image 689
shekwo Avatar asked Dec 24 '15 20:12

shekwo


People also ask

Why php artisan serve not working?

There could be multiple reasons for this problem one of the reasons is using old dependencies. step 1: Check your current version of PHP and version of dependencies if they don't match proceed to next step. step 2: replace the older dependencies with the newer one in composer. json file.

How do I fix 500 internal server error on laravel?

If you have a 500 Server Error, just rename the ". env. example" to ". env" and run: - php artisan key:generate - php artisan cache:clear - php artisan config:clear In my case, I pulled the project to Github repo to local machine.

What is php artisan serve in laravel?

The Laravel PHP artisan serve command helps running applications on the PHP development server. As a developer, you can use Laravel artisan serve to develop and test various functions within the application. It also accepts two additional options. You can use the host for changing application's address and port.


1 Answers

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.

like image 84
Udhav Sarvaiya Avatar answered Oct 20 '22 19:10

Udhav Sarvaiya