# Is OpCache enabled by default in php 5.5 and later or not?

- Thread: https://externals.io/message/84344
- Original archive: https://news-web.php.net/php.internals/84344
- Started by j adams on 2015-03-05T16:12:58+00:00
- Messages: 5
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #84344 — j adams — 2015-03-05T16:12:58+00:00

URL: https://externals.io/message/84344#84344

I don't know if this is a question for the documentation team or not, but
figured I'd start here. There does not appear to be any definitive, clear,
reliable information on PHP's op caching functionality in recent 5.*
versions and this problem needs to be remedied.

Question 1: Is OpCache enabled by default in php 5.5 and later or not?

This page:
http://php.net/manual/en/intro.opcache.php
says "This extension is bundled with PHP 5.5.0 and later, and is »
available in PECL for PHP versions 5.2, 5.3 and 5.4."

But this page:
http://php.net/manual/en/opcache.installation.php
says "PHP 5.5.0 and later

OPcache can only be compiled as a shared extension. If you have disabled
the building of default extensions with --disable-all , you must compile
PHP with the --enable-opcache option for OPcache to be available.

Once compiled, you can use the zend_extension configuration directive to
load the OPcache extension into PHP. This can be done with
zend_extension=/full/path/to/opcache.so on non-Windows platforms, and
zend_extension=C:\path\to\php_opcache.dll on Windows."



Question 2:
If OpCache is enabled, does it require any php.ini settings or not? Does it
show any functions or constants or `phpinfo()` that will reveal its
existence?  I've got php 5.6.6 installed on CentOS 7 and I can find neither
hide nor hair of it.  There is, however, an opcache package one can install
(php56u-opcache.x86_64 in my case).



Question 3:
What about Zend Optimizer? Still other articles say it has been integrated
into php 5.5 and later, but this mythical beast also makes no sign to
indicate its inclusion either. Some articles:
https://wiki.php.net/rfc/optimizerplus
https://wordpress.org/support/topic/looking-ahead-to-php-55-zend-optimizer-the-end-of-apc
http://www.internetnews.com/blog/skerner/php-5-5-to-include-open-source-zend-optimizer-.html


Seems to me there is currently a lot of confusion surrounding OPCache and
it should be cleared up.

---

## #84345 — Rasmus Lerdorf — 2015-03-05T16:31:56+00:00

URL: https://externals.io/message/84344#84345 · In reply to: #84344

> I don't know if this is a question for the documentation team or not, but
> figured I'd start here. There does not appear to be any definitive, clear,
> reliable information on PHP's op caching functionality in recent 5.*
> versions and this problem needs to be remedied.
> 
> Question 1: Is OpCache enabled by default in php 5.5 and later or not?
> 
> This page:
> http://php.net/manual/en/intro.opcache.php
> says "This extension is bundled with PHP 5.5.0 and later, and is »
> available in PECL for PHP versions 5.2, 5.3 and 5.4."
> 
> But this page:
> http://php.net/manual/en/opcache.installation.php
> says "PHP 5.5.0 and later
> 
> OPcache can only be compiled as a shared extension. If you have disabled
> the building of default extensions with --disable-all , you must compile
> PHP with the --enable-opcache option for OPcache to be available.
> 
> Once compiled, you can use the zend_extension configuration directive to
> load the OPcache extension into PHP. This can be done with
> zend_extension=/full/path/to/opcache.so on non-Windows platforms, and
> zend_extension=C:\path\to\php_opcache.dll on Windows."
> 
> 
> 
> Question 2:
> If OpCache is enabled, does it require any php.ini settings or not? Does it
> show any functions or constants or `phpinfo()` that will reveal its
> existence?  I've got php 5.6.6 installed on CentOS 7 and I can find neither
> hide nor hair of it.  There is, however, an opcache package one can install
> (php56u-opcache.x86_64 in my case).
> 
> 
> 
> Question 3:
> What about Zend Optimizer? Still other articles say it has been integrated
> into php 5.5 and later, but this mythical beast also makes no sign to
> indicate its inclusion either. Some articles:
> https://wiki.php.net/rfc/optimizerplus
> https://wordpress.org/support/topic/looking-ahead-to-php-55-zend-optimizer-the-end-of-apc
> http://www.internetnews.com/blog/skerner/php-5-5-to-include-open-source-zend-optimizer-.html

Opcache is bundled with PHP as of PHP 5.5, but distros like to unbundle
things and provide them as separate packages. We can't do much about
that and it is also hard to document all the variations distros come up
with. So yes, in your case you need to install the opcache package.
Presumably the way Centos has created the rpm it will add the
appropriate magic ini settings and you will see opcache listed in your
 `phpinfo()` output after installing that package.

And ZendOptimizer is the same as Opcache in this context.

-Rasmus

---

## #84346 — Rowan Collins — 2015-03-05T17:11:47+00:00

URL: https://externals.io/message/84344#84346 · In reply to: #84344

j adams wrote on 05/03/2015 16:12:
> I don't know if this is a question for the documentation team or not, but
> figured I'd start here. There does not appear to be any definitive, clear,
> reliable information on PHP's op caching functionality in recent 5.*
> versions and this problem needs to be remedied.
>
> Question 1: Is OpCache enabled by default in php 5.5 and later or not?
>
> This page:
> http://php.net/manual/en/intro.opcache.php
> says "This extension is bundled with PHP 5.5.0 and later, and is »
> available in PECL for PHP versions 5.2, 5.3 and 5.4."
>
> But this page:
> http://php.net/manual/en/opcache.installation.php
> says "PHP 5.5.0 and later
>
> OPcache can only be compiled as a shared extension. If you have disabled
> the building of default extensions with --disable-all , you must compile
> PHP with the --enable-opcache option for OPcache to be available.
>
> Once compiled, you can use the zend_extension configuration directive to
> load the OPcache extension into PHP. This can be done with
> zend_extension=/full/path/to/opcache.so on non-Windows platforms, and
> zend_extension=C:\path\to\php_opcache.dll on Windows."
>
>
>
> Question 2:
> If OpCache is enabled, does it require any php.ini settings or not? Does it
> show any functions or constants or `phpinfo()` that will reveal its
> existence?  I've got php 5.6.6 installed on CentOS 7 and I can find neither
> hide nor hair of it.  There is, however, an opcache package one can install
> (php56u-opcache.x86_64 in my case).
>
>
>
> Question 3:
> What about Zend Optimizer? Still other articles say it has been integrated
> into php 5.5 and later, but this mythical beast also makes no sign to
> indicate its inclusion either. Some articles:
> https://wiki.php.net/rfc/optimizerplus
> https://wordpress.org/support/topic/looking-ahead-to-php-55-zend-optimizer-the-end-of-apc
> http://www.internetnews.com/blog/skerner/php-5-5-to-include-open-source-zend-optimizer-.html
>
>
> Seems to me there is currently a lot of confusion surrounding OPCache and
> it should be cleared up.


I think part of your confusion here is over terminology:

- Every module of PHP is referred to as an "extension", however deeply 
embedded it is in the language. The most basic functions you can think 
of, like string and array manipulation, are in "ext/standard" in the source.
- A module being "bundled" means that it is included in the official 
tarball releases on php.net, and indicates a certain guarantee of 
maintenance for compatibility with new versions of PHP.
- Some bundled extensions cannot be disabled, because to do so would 
break too many dependencies. Most can technically be disabled, and/or 
built as separate shared libraries to be enabled in your php.ini as 
desired. In the case of OpCache, it's bundled, but as a shared library.
- The PHP you install on a Linux system will most likely NOT be the 
official tarball, but something put together by your Linux distribution. 
They are under no obligation to handle all bundled extensions the same 
way, or enable them by default. They may for instance install the 
extensions as shared libraries and offer a script to enable/disable 
them, or they may put them all into separate packages which you have to 
install and then configure themselves automatically.
- Oh, and roughly speaking "OpCache" is the name for the open sourced 
version of "ZendOptimizer+", i.e. the version which was made available 
as a PECL download for PHP 5.2, 5.3, and 5.4, and included as a 
"bundled" extension in PHP 5.5 onwards.

This is all a rather long-winded way of saying the same thing Rasmus 
just said, but maybe it will help. :)

Regards,
-- 
Rowan Collins
[IMSoP]

---

## #84347 — j adams — 2015-03-05T17:46:31+00:00

URL: https://externals.io/message/84344#84347 · In reply to: #84346

Thank you so much for the generous clarity. Personally, I wish this sort of
information was clearly visible in the docs. However, I don't want to
introduce unnecessary complications there. Should I mention this to the
docs team? It might help eliminate some of the speculative/incorrect
information at the top of google search results.

On Thu, Mar 5, 2015 at 9:11 AM, Rowan Collins <rowan.collins@gmail.com>
wrote:

> j adams wrote on 05/03/2015 16:12:
>
>  I don't know if this is a question for the documentation team or not, but
> > […]
>
>
> I think part of your confusion here is over terminology:
>
> - Every module of PHP is referred to as an "extension", however deeply
> embedded it is in the language. The most basic functions you can think of,
> like string and array manipulation, are in "ext/standard" in the source.
> - A module being "bundled" means that it is included in the official
> tarball releases on php.net, and indicates a certain guarantee of
> maintenance for compatibility with new versions of PHP.
> - Some bundled extensions cannot be disabled, because to do so would break
> too many dependencies. Most can technically be disabled, and/or built as
> separate shared libraries to be enabled in your php.ini as desired. In the
> case of OpCache, it's bundled, but as a shared library.
> - The PHP you install on a Linux system will most likely NOT be the
> official tarball, but something put together by your Linux distribution.
> They are under no obligation to handle all bundled extensions the same way,
> or enable them by default. They may for instance install the extensions as
> shared libraries and offer a script to enable/disable them, or they may put
> them all into separate packages which you have to install and then
> configure themselves automatically.
> - Oh, and roughly speaking "OpCache" is the name for the open sourced
> version of "ZendOptimizer+", i.e. the version which was made available as a
> PECL download for PHP 5.2, 5.3, and 5.4, and included as a "bundled"
> extension in PHP 5.5 onwards.
>
> This is all a rather long-winded way of saying the same thing Rasmus just
> said, but maybe it will help. :)
>
> Regards,
> --
> Rowan Collins
> [IMSoP]

---

## #84349 — Rowan Collins — 2015-03-05T18:50:40+00:00

URL: https://externals.io/message/84344#84349 · In reply to: #84347

j adams wrote on 05/03/2015 17:46:
> Thank you so much for the generous clarity. Personally, I wish this 
> sort of information was clearly visible in the docs. However, I don't 
> want to introduce unnecessary complications there. Should I mention 
> this to the docs team? It might help eliminate some of the 
> speculative/incorrect information at the top of google search results.

If you can think where to put it, go ahead and suggest it - better 
still, open up https://edit.php.net and submit a patch. HowTos are here, 
if you haven't already found them: http://doc.php.net/tutorial/

That said, I hope I haven't got any of the details wrong there - like I 
say, I'm not really an Internals hacker, just an interested observer and 
wannabe...

Regards,
-- 
Rowan Collins
[IMSoP]
