将php更新到php 8后guzzlehttp/guzzle不起作用 [英] guzzlehttp/guzzle dosn't work after update php to php 8

查看:80
本文介绍了将php更新到php 8后guzzlehttp/guzzle不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Laravel 8 中的 guzzlehttp/guzzle 包.升级到 PHP 8 后,我得到:

I use the guzzlehttp/guzzle package in Laravel 8. After upgrading to PHP 8, I get:

Symfony \ Component \ ErrorHandler \ Error \ FatalError:无效的操作码117/2/0.在第412行的文件../vendor/defuse/php-encryption/src/Core.php中

composer.json:

composer.json:

    "require": {
        "php": "^8.0",
        "doctrine/dbal": "^2.12.1",
        "fideloper/proxy": "^4.4",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^8.12",
        "laravel/passport": "^10.0",
        "laravel/tinker": "^2.5",
      "ext-json": "*"
    },
    "require-dev": {
        "facade/ignition": "^2.5",
        "fakerphp/faker": "^1.9.1",
        "mockery/mockery": "^1.4.2",
        "nunomaduro/collision": "^5.0",
        "phpunit/phpunit": "^9.3.3"
    },

php -v :

PHP 8.0.0RC3 (cli) (built: Oct 31 2020 17:06:57) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.0RC3, Copyright (c), by Zend Technologies

UPD 1 如果我在 $ this-> client = new \ GuzzleHttp \ Client;之前调用 opcache_reset(); $ response = $ this-> client-> post(...),它可以正常工作.

UPD 1 If I call opcache_reset (); before $this->client = new \GuzzleHttp\Client; $response = $this->client->post(...), it works.

UPD 2 $ service php8.0-fpm reload -没有帮助.

UPD 3 重新启动服务器没有帮助.

UPD 3 Reboot server did not help.

我该如何解决?

推荐答案

问题不是 guzzlehttp/guzzle .问题是,在 Ubuntu 20.10 PHP8 上,无法清除 opcache .如果在调用 new \ GuzzleHttp \ Client; 之前执行 opcache_reset(); ,则一切正常.

The problem is not guzzlehttp/guzzle. The problem is, on Ubuntu 20.10 PHP8 does not clear the opcache. If you do opcache_reset(); before calling new \GuzzleHttp\Client;, then everything works.

这篇关于将php更新到php 8后guzzlehttp/guzzle不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆