【问题标题】:Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 (php)警告:未知:无法打开流:第 0 行(php)的未知中没有此类文件或目录
【发布时间】:2020-10-24 03:01:16
【问题描述】:

我不断收到此错误“警告:未知:无法打开流:第 0 行的未知中没有此类文件或目录致命错误:未知:打开失败需要'C:\xampp\htdocs\file\ server.php' (include_path='C:\xampp\php\PEAR') in Unknown on line 0" 在我运行项目之后,尽管我已经尝试并遵循一些来自网络的解决方案,例如 php.ini 文件。 ini "include_path=" 是具体的,但它没有工作。顺便说一句,我的电脑中没有防病毒软件。有人可以帮我解决这个错误吗?谢谢

【问题讨论】:

    标签: php laravel ini


    【解决方案1】:

    您的 server.php 文件丢失。

    只需在你的 laravel 项目的根目录下创建一个名为 server.php 的文件并粘贴以下代码:

    <?php
    
    /**
     * Laravel - A PHP Framework For Web Artisans
     *
     * @package  Laravel
     * @author   Taylor Otwell <taylor@laravel.com>
     */
    
    $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';
    

    .env 文件中的debug=false 更改为debug=true,或者您需要编辑config/app.php 文件并将debug = false 更改为debug = true

    【讨论】:

      【解决方案2】:

      如果您使用 Laravel,您可以尝试将第 24 行和第 25 行恢复到项目的 phpunit.xml 文件中。

              <server name="DB_CONNECTION" value="sqlite"/>
              <server name="DB_DATABASE" value=":memory:"/>
      
      

      默认情况下,它们会被注释,因此如果您取消注释它们应该可以工作。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-05-30
        • 2015-05-07
        • 2011-07-16
        • 2018-10-01
        • 1970-01-01
        相关资源
        最近更新 更多