Reputation: 234
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
Upvotes: 14
Views: 111589
Reputation: 189
I faced the same problem but disabling antivirus didn't help. However, after visiting my Avast Antivirus table I noticed that the server.php file had been quarantined. I therefore restored and added it as an exception. And now my server is up with no errors
Upvotes: 0
Reputation: 7199
php -S localhost:8000
Make sure there is no space between "localhost:" and "8000"
Upvotes: 0
Reputation: 83
This thing mostly happen when have a virus guard so create exception or if it deleted by virus guard create file called server.php and past below 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';
Upvotes: 0
Reputation: 330
I am using Avast Free Antivirus, and it has detected server.php as a virus. Please restore server.php from the quarantine of your antivirus software.
Upvotes: 1
Reputation: 129
same thing happens with me server.php file is deleted by antivirus. so, I just add server.php file inside vendors\laravel\framework\src\illuminate\foundation\resources it works for me
Upvotes: 0
Reputation: 1
You can also go in your antivurus params and restore server.php + add an exception it worked fine for me without recreate a project.
Upvotes: 0
Reputation: 261
Type in the command line:
php -S localhost:8000 -t public
because port is not public
Upvotes: 26
Reputation: 21
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
Upvotes: 1
Reputation: 803
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.
Upvotes: 53
Reputation: 1
same problem happen to me: just delete the project and uninstall the avast antivirus and re create the project
Upvotes: -1
Reputation: 2570
Try to disable your anti-virus, this happens to me, it seems avast deletes my server.php.
So I added it to the exception
Upvotes: 41