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
254
votes
5 answers

How to use PHP OPCache?

PHP 5.5 has been released and it features a new code caching module called OPCache, but there doesn't appear to be any documentation for it. So where is the documentation for it and how do I use OPcache?
Danack
  • 24,939
  • 16
  • 90
  • 122
242
votes
4 answers

What does a \ (backslash) do in PHP (5.3+)?

What does a \ do in PHP? For example, CSRF4PHP has \FALSE, \session_id, and \Exception: public function __construct($timeout=300, $acceptGet=\FALSE){ $this->timeout = $timeout; if (\session_id()) { $this->acceptGet = (bool)…
Alfred
  • 60,935
  • 33
  • 147
  • 186
51
votes
4 answers

Disable OPCache temporarily

I recently moved to PHP 5.4 and installed OPCache, it's very powerful! How can I temporarily disable the cache? I tried : ini_set('opcache.enable', 0); But it has no effect. Thanks
SoCkEt7
  • 2,237
  • 5
  • 22
  • 30
49
votes
4 answers

How to determine if PHP OPcache is enabled or not?

I am trying to enable opCache on my server (ubuntu 12.04 LTS, running apache 2.4.7 with PHP Version 5.5.10-1+deb.sury.org~precise+1). Before starting to do anything, I read this highly relevant post which told me that opCache is disabled by default…
Salvador Dali
  • 214,103
  • 147
  • 703
  • 753
43
votes
1 answer

Difference between APC, APCu and Opcache?

I am running a web server with the following packages; php-apc 3.1.7-1 php5-fpm 5.3.10-1ubuntu3.10 However, i have built a new server on Ubuntu 14.04 and seems like php-apc is not available anymore. Therefore, APC was the lifeserver for my huge…
martyr
  • 591
  • 1
  • 5
  • 7
36
votes
4 answers

Is there any compatible memory cache for PHP 7?

I would like to use PHP 7. However there seems to be no option for key-value memory caching. APC is discontinued. XCache will not be available for PHP 7 for some time. Is there an available alternative for PHP 7? Or is there a way to use PHP7's…
Frodik
  • 14,986
  • 23
  • 90
  • 141
36
votes
3 answers

Zend OPCache - opcache.enable_cli 1 or 0? What does it do?

In the documentation it says "mostly used for debugging" which would lead me think "never enable it unless you've a problem and need to do some debugging," however reading mostly everything that I could find about it says to enable it…
Jack
  • 653
  • 1
  • 6
  • 14
31
votes
3 answers

APC -> APCu / OPCache, performance poor

I have an m3.xlarge EC2 instance that I updated to PHP 5.5.11 today. With this update, it overwrote php55-pecl-apc with php55-pecl-apcu. After reading and experimenting, my understanding is that APC has been replaced with OPCache, except for a key…
Tallboy
  • 12,847
  • 13
  • 82
  • 173
30
votes
1 answer

What is userland caching APCu extension in PHP?

Just a question related to OPcache cause I didn't understand it and find an answer on Google: When we talk about userland caching, what does it mean? I know PHP is pre-bundled with the new Zend OPcache extension and that this extension caches op…
tonix
  • 6,671
  • 13
  • 75
  • 136
30
votes
1 answer

PHP OPcache optimization levels - what are they?

There is an opcache.optimization_level php.ini directive. It is a bitmask a defaults to 0xffffffff - so by default OPcache does all the optimizations. What kind of optimizations does OPcache do? What passes on bytecode are done? Follow-up question:…
Jakub Kulhan
  • 1,572
  • 2
  • 16
  • 37
20
votes
3 answers

PHP opcache reset + symlink-style deployment

I am trying to reset PHP opcache after a symlink-style deployment. There is the opcache_reset.php file in my project which is executing by wget after the document root's symlink replacement:
Vitaly Chirkov
  • 1,692
  • 3
  • 17
  • 33
18
votes
2 answers

Turn off Caching in MAMP

Trying to turn off caching in MAMP for development, waiting for cache to expire after making small changes is killing my productivity. (Problem started when I changed to PHP 5.5.3, changing back doesn't fix it) After researching I've taken the…
Philippe
  • 539
  • 1
  • 5
  • 21
17
votes
8 answers

Windows, XAMPP, PHP 7 and opcache

I've installed latest XAMPP server with PHP 7 (update: checked also PHP 7.1) (on my Windows 10 system). Wanted to use opcache, so I enabled it in php.ini.…
Jazi
  • 6,569
  • 13
  • 60
  • 92
14
votes
2 answers

How can I enable opcache preloading in PHP 7.4?

I'd like to enable opcache preloading (RFC) on my production servers in PHP 7.4. I'm using Symfony 4 if it changes anything.
Mike Doe
  • 16,349
  • 11
  • 65
  • 88
14
votes
5 answers

PHPDocumentor 2 and PHP 7 with opcache issues in Doctrine

Hopefully someone here knows a thing or 2 about this. Short Question I am running into an error using phpdoc on the command line, installed via pear on PHP 7.0.2. The error is: #> phpdoc PHP Fatal error: Uncaught…
Paul Carlton
  • 2,785
  • 2
  • 24
  • 42
1
2 3
20 21