Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php - Unknown: Failed opening required on line 0. laravel 5.6

I just installed laracast/flash and updated nesbot/carbon via composer. The cmd went nuts while downloading carbon. Cmd interface displayed scattered words and boxes all over the interface for a while and the download was completed. Did php artisan serve at localhost:8000 and I've got the following errors.

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\NC World\ProjectName\server.php' (include_path='C:\xampp\php\PEAR') in Unknown on line 0

like image 597
Angnima Sherpa Avatar asked Mar 30 '18 12:03

Angnima Sherpa


4 Answers

This error happens because the server.php file is missing. May be it is deleted or removed from your project directory. I have already faced this problem. Just add the server.php file at root of your project. You can add this file from any other laravel project directory or just create a file named server.php at root directory of your laravel project and paste the following code:

<?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <[email protected]>
 */

$uri = urldecode(
    parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);

// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
    return false;
}

require_once __DIR__.'/public/index.php';

This process works for me.

like image 149
rroy Avatar answered Nov 15 '22 19:11

rroy


Type in the command line:

php -S localhost:8000 -t public

because port is not public

like image 32
Laid said Avatar answered Nov 15 '22 19:11

Laid said


Try to disable your anti-virus, this happens to me, it seems avast deletes my server.php.

So I added it to the exception

like image 23
Ikong Avatar answered Nov 15 '22 19:11

Ikong


go to main directory and create new server.php file even you can also copy paste from another created project

same happens to me and i just remove antivirus from my system and just create new file of server

like image 26
WoW Technologies Avatar answered Nov 15 '22 20:11

WoW Technologies