Search code examples
phplaravelini

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 (php)


I keep on getting 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\file\server.php' (include_path='C:\xampp\php\PEAR') in Unknown on line 0" after I run the project, though I have tried and follow some solutions from the net like in the php.ini "include_path=" to be specific but it didn't work. And btw, I don't have anti-virus software in my pc. Can someone help me how to fix this error? Thanks


Solution

  • your server.php file is missing.

    just create a file named server.php at the 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';
    

    OR

    Change debug=false to debug=true in your .env file or You need to edit the config/app.php file and change the debug = false to debug = true.