Search code examples
phpnginxfpmphp-8

Why is the opcache not flushed?


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

Symfony\Component\ErrorHandler\Error\FatalError: Invalid opcode 117/2/0. in file ../vendor/defuse/php-encryption/src/Core.php on line 412

nginx config:

server {
  listen 80;
  root /var/www/finex_production/public/;

  index index.php;
  server_name ff.loc;
  
  location / {
    try_files $uri $uri/ /index.php?$query_string;
  }

  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
  }

  client_max_body_size 256M;
  fastcgi_read_timeout 900;
}

PHP 7.4 is removed.

If I call opcache_reset (); before, I don't get error.


Solution

  • I fixed it by temporarily setting opcache.optimization_level=0 in php.ini.

    Still according to this post, it's a known bug which should be fixed in PHP 8.0.1