Questions tagged [opcache]

OPcache is a PHP opcode cache introduced in PHP 5.5 (and is also available as a PECL extension for PHP 5.2+). It is based on the Zend Optimizer+

The Zend OPcache provides faster PHP execution through opcode caching and optimization. It improves PHP performance by storing precompiled script bytecode in the shared memory. This eliminates the stages of reading code from the disk and compiling it on future access. In addition, it applies a few bytecode optimization patterns that make code execution faster.

Also see the OpCache Readme, the PHP OPcache documentation and the PECL OPcache page.

304 questions
3
votes
1 answer

What's the migration path from APC to OPcache?

What's the proper way to upgrade php and the APC caching mechanism to the newer/better OPcache? Is there a specific tool or reconfiguration script?
Peter Petrik
  • 429
  • 4
  • 5
3
votes
0 answers

0% hit rate with OPcache and PHP-FPM/Nginx

I'm trying to get PHP 5.5's OPcache working on an Nginx/PHP-FPM setup running on Ubuntu 14.04 in Vagrant. I have my /etc/php5/mods-available/opcache.ini directory configured as…
Mark Locker
  • 831
  • 1
  • 10
  • 19
3
votes
2 answers

When exactly does PHP 5.5+ Opcache check file timestamp based on revalidate_freq setting

Apologies of this has been asked before/elsewhere but I cannot find the answer. We have some issues in the minute following a deploy and we think they are Opcache related. On our live setup we have the following Opcache…
Luke Cousins
  • 2,068
  • 1
  • 20
  • 38
3
votes
2 answers

OpCache not caching

ive recently activated opcache but it doesn't appear to be working. It's confirmed activated via phpinfo() As you can see 0 hits 1 miss 1 cached script (opcached gui) What am I missing? Server is a Linux server centos 6.5 vps PHP 5.5 A bit more…
user1691659
  • 55
  • 1
  • 9
3
votes
1 answer

What does Zend OPcache's "num_cached_keys" statistic mean?

Among the data points returned by opcache_get_status() is: 'opcache_statistics' => [ 'num_cached_scripts' => 90, 'num_cached_keys' => 96, 'max_cached_keys' => 3907, ... ] The number of cached scripts is correct and understandable…
Zilk
  • 8,917
  • 7
  • 36
  • 44
3
votes
1 answer

Doctrine is freaking out when I turn on php opcache on

I'm having a really strange problem with Doctrine and PHP 5.5.6 Opcache. Everything is working just fine when the opcache module is turned off. Once I turn it on, I begin getting the following exception: Fatal error: Uncaught exception…
tftd
  • 16,203
  • 11
  • 62
  • 106
3
votes
1 answer

use of php spl_autoload_unregister

Why there is the function spl_autoload_unregister ? If I register autoloader in what cases I would want to unregister it ? seems redundant to me. And another question in that topic: since now php 5.5 comes with built-in opcache, and in the past many…
Adidi
  • 5,097
  • 4
  • 23
  • 30
2
votes
1 answer

Is blacklist of opcache ignored when file_cache is enabled?

I am using php-fpm 7.4.3 on ubuntu 20.04. My blacklist of opcache doesn't work at all. Scripts I visited are cached when file_cache is enabled. Here's my…
shingo
  • 18,436
  • 5
  • 23
  • 42
2
votes
0 answers

PHP 8.1.4 - Opcache runs out of memory

I've been having trouble where TTFB would increase after a few hours. I initially thought it was due to something in IIS, but it turns out it's actually opcache. I also noticed the "manual restarts" value keeps increasing. No manual restarts are…
ChrisB3127
  • 31
  • 3
2
votes
1 answer

Opcache Preloading with Symfony 5.4 / PHP8 / Platform.sh

I am attempting to set up Opcache Preloading on Symfony 5.4 running on PHP8 at Platform.sh, and running into a fatal error. Configuration Necessary pieces included: // platform.app.yaml ... variables php 'opcache.preload':…
Robert Wade
  • 4,918
  • 1
  • 16
  • 35
2
votes
0 answers

Error Building PHP 8 Dockerfile With OPCache Enabled

Randomly when I run my docker build i get a mail error halting CI. If I rerun the CI script in Gitlab once or twice woth no changes made to config it often successfully builds. I am at a loss as to why this is an intermittent issue and how to…
Chris Rutherfurd
  • 1,617
  • 1
  • 15
  • 32
2
votes
1 answer

Opcache preloading and missing App_KernelProdContainer.preload.php

After following the documentation, my new OPCache settings are like…
Khribi Wessim
  • 287
  • 2
  • 12
2
votes
0 answers

What is causing a segfault when Opcache file cache is enabled in a symlink deployment?

I'm using PHP deployer which is a symlink based deployment tool which calls opcache:reset after deployment. Recently I'm getting a segfault in my PHP-FPM processes after deployment. This manifests as segfault entires in the PHP logs/memory exhausted…
jamieburchell
  • 761
  • 1
  • 5
  • 18
2
votes
0 answers

Opcache self clears and breaks code execution

I have a Magento 2 store, but this seems to be a PHP issue, with opcache enabled and sometimes the opcache seems to clear itself and I end up with a store were some actions can't be performed. Sometimes when I manually clear opcache, I also get…
Filipe Sá
  • 21
  • 2
2
votes
1 answer

'Opcache' fails to install in Docker

I have setup the new Docker container with image "FROM php:7.3-apache-stretch" and trying to install 'Opcache' into it but fails. System: Linux PHP Version: 7.3.11 Apache Version: Apache/2.4.25 (Debian) DockerFile FROM php:7.3-apache-stretch ARG…
SandipT
  • 79
  • 2
  • 6