【问题标题】:Laravel 5.8 Declaration of Illuminate\Container\Container::get($id) must be compatible with Psr\Container\ContainerInterface::get(string $id)Laravel 5.8 声明 Illuminate\Container\Container::get($id) 必须与 Psr\Container\ContainerInterface::get(string $id) 兼容
【发布时间】:2021-04-22 23:21:18
【问题描述】:

在我将我的 php 升级到 PHP 7.4 之后,我现在遇到了这个错误,

Declaration of Illuminate\Container\Container::get($id) must be compatible with 
Psr\Container\ContainerInterface::get(string $id)
/home/forge/myapp.com/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 15

我已尝试运行 Composer Update 但它现在仍在运行 可能是什么问题以及如何解决此问题。

【问题讨论】:

标签: php laravel


【解决方案1】:

通过以下命令删除您的作曲家缓存:

composer clearcache

然后删除供应商文件夹并运行composer install。我希望这个解决方案对您有所帮助。

【讨论】:

【解决方案2】:

问题是在升级 PHP 后,我必须在以下位置更新 nginx 虚拟主机 sudo nano /etc/nginx/sites-available/nginx_vhost 通过将旧的 PHP7.1-fpm.sock 更改为 PHP7.4-fpm.sock 来自

    location ~ \.php$ {
 
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
   
    }

    location ~ \.php$ {
 
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
   
    }

【讨论】:

    猜你喜欢
    • 2021-06-06
    • 2019-05-06
    • 2021-06-24
    • 1970-01-01
    • 1970-01-01
    • 2023-03-22
    • 2016-10-20
    • 2022-11-28
    • 2017-01-25
    相关资源
    最近更新 更多