php - 未知:第 0 行需要打开失败。laravel 5.6
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/49574906/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
php - Unknown: Failed opening required on line 0. laravel 5.6
提问by Angnima Sherpa
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.
我刚刚安装了 laracast/flash 并通过 composer 更新了 nesbot/carbon。cmd 在下载 carbon 时发疯了。Cmd界面一会显示整个界面散乱的字和框,下载完成。做了php artisan serve
在localhost:8000
,我有以下错误。
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
警告:未知:无法打开流:第 0 行的未知中没有此类文件或目录
致命错误:未知:无法在第 0 行的未知中打开所需的 'C:\xampp\htdocs\NC World\ProjectName\server.php' (include_path='C:\xampp\php\PEAR')
回答by Ikong
Try to disable your anti-virus, this happens to me, it seems avast deletes my server.php.
尝试禁用您的防病毒软件,这发生在我身上,似乎 avast 删除了我的 server.php。
So I added it to the exception
所以我将它添加到异常中
回答by rroy
This error happens because the server.phpfile is missing. May be it is deleted or removedfrom your project directory. I have already faced this problem. Just add the server.phpfile at root of your project. You can add this file from any other laravel project directory or just create a file named server.phpat root directory of your laravel project and paste the following code:
发生此错误是因为缺少server.php文件。可能它已从您的项目目录中删除或删除。我已经遇到过这个问题。只需在项目的根目录添加server.php文件即可。您可以从任何其他 Laravel 项目目录添加此文件,或者只需在 Laravel 项目的根目录创建一个名为server.php的文件并粘贴以下代码:
<?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.
这个过程对我有用。
回答by Laid said
Type in the command line:
在命令行中输入:
php -S localhost:8000 -t public
because port is not public
因为端口不是公共的
回答by Ari
You can also go in your antivurus params and restore server.php + add an exceptionit worked fine for me without recreate a project.
您还可以进入您的antivuru 参数并恢复 server.php + 添加一个异常,它对我来说工作正常,而无需重新创建项目。
回答by neehal maalik
same problem happen to me: just delete the project and uninstall the avast antivirus and re create the project
同样的问题发生在我身上:只需删除项目并卸载 avast 防病毒软件并重新创建项目
回答by WoW Technologies
go to main directory and create new server.php file even you can also copy paste from another created project
转到主目录并创建新的 server.php 文件,即使您也可以从另一个创建的项目复制粘贴
same happens to me and i just remove antivirus from my system and just create new file of server
我也发生了同样的事情,我只是从我的系统中删除了防病毒软件,然后创建了服务器的新文件