Skip to content

Commit 36d8be7

Browse files
committed
Consistent OPcache casing
This seems to be the official casing. https://www.php.net/manual/en/book.opcache.php It's the same one used for php -v.
1 parent 25acbe7 commit 36d8be7

File tree

10 files changed

+36
-36
lines changed

10 files changed

+36
-36
lines changed

Book/php5/build_system/building_extensions.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ As an example, consider a PHP build compiled using this configure line::
2525
--enable-debug --enable-maintainer-zts \
2626
--enable-opcache --with-gmp=shared
2727

28-
In this case both the opcache extension and GMP extension are compiled into shared objects located in the ``modules/``
28+
In this case both the OPcache extension and GMP extension are compiled into shared objects located in the ``modules/``
2929
directory. You can load both either by changing the ``extension_dir`` or by passing absolute paths::
3030

3131
~/php-src> sapi/cli/php -dzend_extension=`pwd`/modules/opcache.so \
@@ -51,7 +51,7 @@ everything else. The reason is simply that building external extensions as share
5151
intrusive), as you will see in a moment. Another benefit is that you can update the extension without rebuilding PHP.
5252

5353
.. [#] We'll explain the difference between a "normal" extension and a Zend extension later in the book. For now it
54-
suffices to know that Zend extensions are more "low level" (e.g. opcache or xdebug) and hook into the workings of
54+
suffices to know that Zend extensions are more "low level" (e.g. OPcache or Xdebug) and hook into the workings of
5555
the Zend Engine itself.
5656
5757
Installing extensions from PECL
@@ -216,12 +216,12 @@ The ``--re`` switch lists all ini settings, constants, functions and classes add
216216
}
217217
218218
The ``--re`` switch only works for normal extensions, Zend extensions use ``--rz`` instead. You can try this on
219-
opcache::
219+
OPcache::
220220

221221
~/myphp/bin> ./php -dzend_extension=opcache.so --rz "Zend OPcache"
222222
Zend Extension [ Zend OPcache 7.0.3-dev Copyright (c) 1999-2013 by Zend Technologies <http://www.zend.com/> ]
223223

224-
As you can see, this doesn't display any useful information. The reason is that opcache registers both a normal
224+
As you can see, this doesn't display any useful information. The reason is that OPcache registers both a normal
225225
extension and a Zend extension, where the former contains all ini settings, constants and functions. So in this
226226
particular case you still need to use ``--re``. Other Zend extensions make their information available via ``--rz``
227227
though.

Book/php5/build_system/building_php.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ safety, which is very helpful during development.
3535

3636
Another issue is that nearly all distributions apply additional patches to PHP. In some cases these patches only
3737
contain minor changes related to configuration, but some distributions make use of highly intrusive patches like
38-
Suhosin. Some of these patches are known to introduce incompatibilities with low-level extensions like opcache.
38+
Suhosin. Some of these patches are known to introduce incompatibilities with low-level extensions like OPcache.
3939

4040
PHP only provides support for the software as provided on `php.net`_ and not for the distribution-modified versions. If
4141
you want to report bugs, submit patches or make use of our help channels for extension-writing, you should always work
@@ -212,12 +212,12 @@ your PHP binary contains using the ``-m`` option. For a default PHP 5.5 build th
212212
xmlwriter
213213
214214
If you now wanted to stop compiling the CGI SAPI, as well as the tokenizer and sqlite3 extensions and instead enable
215-
opcache and gmp, the corresponding configure command would be::
215+
OPcache and gmp, the corresponding configure command would be::
216216

217217
~/php-src> ./configure --disable-cgi --disable-tokenizer --without-sqlite3 \
218218
--enable-opcache --with-gmp
219219

220-
By default most extensions will be compiled statically, i.e. they will be part of the resulting binary. Only the opcache
220+
By default most extensions will be compiled statically, i.e. they will be part of the resulting binary. Only the OPcache
221221
extension is shared by default, i.e. it will generate an ``opcache.so`` shared object in the ``modules/`` directory. You
222222
can compile other extensions into shared objects as well by writing ``--enable-NAME=shared`` or ``--with-NAME=shared``
223223
(but not all extensions support this). We'll talk about how to make use of shared extensions in the next section.

Book/php7/build_system/building_extensions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ As an example, consider a PHP build compiled using this configure line::
2424
--enable-debug --enable-maintainer-zts \
2525
--enable-opcache --with-gmp=shared
2626

27-
In this case both the opcache extension and GMP extension are compiled into shared objects located in the ``modules/``
27+
In this case both the OPcache extension and GMP extension are compiled into shared objects located in the ``modules/``
2828
directory. You can load both either by changing the ``extension_dir`` or by passing absolute paths::
2929

3030
~/php-src> sapi/cli/php -dzend_extension=`pwd`/modules/opcache.so \
@@ -218,12 +218,12 @@ The ``--re`` switch lists all ini settings, constants, functions and classes add
218218
}
219219
220220
The ``--re`` switch only works for normal extensions, Zend extensions use ``--rz`` instead. You can try this on
221-
opcache::
221+
OPcache::
222222

223223
~/myphp/bin> ./php -dzend_extension=opcache --rz "Zend OPcache"
224224
Zend Extension [ Zend OPcache 7.0.3-dev Copyright (c) 1999-2013 by Zend Technologies <http://www.zend.com/> ]
225225

226-
As you can see, this doesn't display any useful information. The reason is that opcache registers both a normal
226+
As you can see, this doesn't display any useful information. The reason is that OPcache registers both a normal
227227
extension and a Zend extension, where the former contains all ini settings, constants and functions. So in this
228228
particular case you still need to use ``--re``. Other Zend extensions make their information available via ``--rz``
229229
though.

Book/php7/build_system/building_php.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ thread safety, which may be helpful to ensure your extension builds in a thread-
3535

3636
Another issue is that nearly all distributions apply additional patches to PHP. In some cases these patches only
3737
contain minor changes related to configuration, but some distributions make use of highly intrusive patches like
38-
Suhosin. Some of these patches are known to introduce incompatibilities with low-level extensions like opcache.
38+
Suhosin. Some of these patches are known to introduce incompatibilities with low-level extensions like OPcache.
3939

4040
PHP only provides support for the software as provided on `php.net`_ and not for the distribution-modified versions. If
4141
you want to report bugs, submit patches or make use of our help channels for extension-writing, you should always work
@@ -223,12 +223,12 @@ your PHP binary contains using the ``-m`` option. For a default PHP 7.0 build th
223223
xmlwriter
224224
225225
If you now wanted to stop compiling the CGI SAPI, as well as the *tokenizer* and *sqlite3* extensions and instead enable
226-
*opcache* and *gmp*, the corresponding configure command would be::
226+
*OPcache* and *gmp*, the corresponding configure command would be::
227227

228228
~/php-src> ./configure --disable-cgi --disable-tokenizer --without-sqlite3 \
229229
--enable-opcache --with-gmp
230230

231-
By default most extensions will be compiled statically, i.e. they will be part of the resulting binary. Only the opcache
231+
By default most extensions will be compiled statically, i.e. they will be part of the resulting binary. Only the OPcache
232232
extension is shared by default, i.e. it will generate an ``opcache.so`` shared object in the ``modules/`` directory. You
233233
can compile other extensions into shared objects as well by writing ``--enable-NAME=shared`` or ``--with-NAME=shared``
234234
(but not all extensions support this). We'll talk about how to make use of shared extensions in the next section.

Book/php7/extensions_design/hooks.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Modifying the Abstract Syntax Tree (AST)
123123
****************************************
124124

125125
When PHP 7 compiles PHP code it converts it into an abstract syntax tree (AST)
126-
before finally generating Opcodes that are persisted in Opcache. The
126+
before finally generating Opcodes that are persisted in OPcache. The
127127
``zend_ast_process hook`` is called for every compiled script and allows you to
128128
modify the AST after it is parsed and created.
129129

@@ -148,13 +148,13 @@ and the result is a ``zend_op_array``.::
148148
zend_op_array *my_extension_compile_file(zend_file_handle *file_handle, int type);
149149

150150
There are two extensions in PHP core that implement this hook: dtrace and
151-
opcache.
151+
OPcache.
152152

153153
- If you start the PHP script with the environment variable ``USE_ZEND_DTRACE``
154154
and compiled PHP with dtrace support, then ``dtrace_compile_file`` is used
155155
from ``Zend/zend_dtrace.c``.
156156

157-
- Opcache stores op arrays in shared memory for better performance, so that
157+
- OPcache stores op arrays in shared memory for better performance, so that
158158
whenever a script is compiled its final op array is served from a cache and
159159
not re-compiled. You can find this implementation in
160160
``ext/opcache/ZendAccelerator.c``.
@@ -170,12 +170,12 @@ and all PHP scripts compiled after the replacement will be handled by your
170170
implementation of the hook.
171171

172172
It is very important to always call the original function pointer, otherwise
173-
PHP cannot compile scripts anymore and Opcache will not work anymore.
173+
PHP cannot compile scripts anymore and OPcache will not work anymore.
174174

175175
The extension overwriting order here is also important as you need to be aware
176-
whether you want to register your hook before or after Opcache, because Opcache
176+
whether you want to register your hook before or after OPcache, because OPcache
177177
does not call the original function pointer if it finds an opcode array entry
178-
in its shared memory cache. Opcache registers their hook as a post startup
178+
in its shared memory cache. OPcache registers their hook as a post startup
179179
hook, which runs after the minit phase for extensions, so by default your hook
180180
will not be called anymore when the script gets cached.
181181

Book/php7/extensions_design/zend_extensions.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Why need a Zend extension ?
103103
Let us warn you : until you have **very advanced** knowledge on PHP internal's Vritual Machine, and until you need to
104104
hook deep into it, you shouldn't need a Zend extension, but a PHP extension will be enough.
105105

106-
Today's most commonly known Zend extensions into PHP's world are OPCache, XDebug, phpdbg and Blackfire. But you know
106+
Today's most commonly known Zend extensions into PHP's world are OPcache, Xdebug, phpdbg and Blackfire. But you know
107107
dozens of PHP extensions next to that don't you ?! That's a clear sign that :
108108

109109
* You should not need a Zend extension for a very big part of your problematics
@@ -215,7 +215,7 @@ In *practice*, what we can say about it is that :
215215
Until some distributions (FreeBSD hear us) change that ...
216216

217217
* Zend extensions are triggered **before** PHP extensions when a request shows in. That means they got a chance to modify
218-
the engine about the current request to come, so that PHP extensions use that modified context. OPCache uses such a
218+
the engine about the current request to come, so that PHP extensions use that modified context. OPcache uses such a
219219
trick so that it can perform its complex tasks before any extension had a chance to prevent it to.
220220

221221
* Same for request shutdown : Zend extensions can assume every PHP extension has shut down the request.
@@ -301,7 +301,7 @@ That's all for now. Let's fill-in those empty-body functions now::
301301

302302
Like said before, ``message_handler()`` is a special hook that Zend extensions may declare to be noticed when another
303303
Zend extension get loaded. But be careful of the order. You must register our "pib" Zend extension first, then
304-
another Zend extension (like OPCache) after that, as the ``message_handler()`` is only called when a Zend extension is
304+
another Zend extension (like OPcache) after that, as the ``message_handler()`` is only called when a Zend extension is
305305
loaded you obviously need to be loaded before to declare it. Chicken and egg.
306306

307307
Then we'll start to dive into the engine, with our ``op_array_handler`` hook::
@@ -479,10 +479,10 @@ How is that possible ? And what for ?.
479479
Well there are several answers to such a question :
480480

481481
* To :doc:`register new PHP functions <php_functions>`, a PHP extension is better than a Zend extension, as it already
482-
knows how to do and has been designed for that specific purpose first. That would be pity not to use it. OPCache
482+
knows how to do and has been designed for that specific purpose first. That would be pity not to use it. OPcache
483483
does that.
484484
* If you need to register about all the hooks in the full lifecycle, you'll obviously need both sides
485-
* If you need to master the order Zend extensions are loaded, f.e to get loaded after OPCache, you will need to be
485+
* If you need to master the order Zend extensions are loaded, f.e to get loaded after OPcache, you will need to be
486486
hybrid
487487

488488
The trick is simple, choose between :
@@ -656,7 +656,7 @@ Our PHP extension is effectively called "pib" and shows up, and our Zend extensi
656656
"pib-zend-extension" and shows up as well. We chose two different names for both parts, we could have chosen the same
657657
name.
658658

659-
.. note:: OPCache and Xdebug use such an hybrid model, they are Zend extensions, but they need to publish PHP
659+
.. note:: OPcache and Xdebug use such an hybrid model, they are Zend extensions, but they need to publish PHP
660660
functions and thus they are also PHP extensions to do so.
661661

662662
Hybrid PHP extension master, Zend extension slave

Book/php7/internal_types/strings/zend_strings.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,9 @@ Interned strings
250250
----------------
251251

252252
Just a quick word here about `interned strings <https://en.wikipedia.org/wiki/String_interning>`_. You could
253-
need such a concept in extension development. Interned strings also interact with OPCache extension.
253+
need such a concept in extension development. Interned strings also interact with OPcache extension.
254254

255-
Interned strings are deduplicated strings. When used with OPCache, they also get reused from request to request.
255+
Interned strings are deduplicated strings. When used with OPcache, they also get reused from request to request.
256256

257257
Say you want to create the string "foo". What you tend to do is simply create a new string "foo"::
258258

@@ -322,25 +322,25 @@ This process is in fact a little bit more complex than this. If you make use of
322322
:doc:`request processing <../../extensions_design/php_lifecycle>`, that string will be interned for sure.
323323
However, if you make use of an interned string as PHP is treating a request, then this string will only get interned for
324324
the current request, and will get cleared after that.
325-
All this is valid if you don't use the OPCache extension, something you shouldn't do : use it.
325+
All this is valid if you don't use the OPcache extension, something you shouldn't do : use it.
326326

327-
When using the OPCache extension, if you make use of an interned string out of a
327+
When using the OPcache extension, if you make use of an interned string out of a
328328
:doc:`request processing <../../extensions_design/php_lifecycle>`, that string will be
329329
interned for sure and will also be shared to every PHP process or thread that will be spawned by you parallelism layer.
330-
Also, if you make use of an interned string as PHP is treating a request, this string will also get interned by OPCache
330+
Also, if you make use of an interned string as PHP is treating a request, this string will also get interned by OPcache
331331
itself, and shared to every PHP process or thread that will be spawned by you parallelism layer.
332332

333-
Interned strings mechanisms are then changed when OPCache extension fires in. OPCache not only allows to intern strings
333+
Interned strings mechanisms are then changed when OPcache extension fires in. OPcache not only allows to intern strings
334334
that come from a request, but it also allows to share them to every PHP process of the same pool. This is done using
335-
shared memory. When saving an interned string, OPCache will also add the ``IS_STR_PERMANENT`` flag to its GC info.
335+
shared memory. When saving an interned string, OPcache will also add the ``IS_STR_PERMANENT`` flag to its GC info.
336336
That flag means the memory allocation used for the structure (``zend_string`` here) is permanent, it could be a shared
337337
read-only memory segment.
338338

339339
Interned strings save memory, because the same string is never stored more than once in memory. But it could waste some
340340
CPU time as it often needs to lookup the interned strings store, even if that process is well optimized yet.
341341
As an extension designer, here are global rules:
342342

343-
* If OPCache is used (it should be), and if you need to create read-only strings : use an interned string.
343+
* If OPcache is used (it should be), and if you need to create read-only strings : use an interned string.
344344
* If you need a string you know for sure PHP will have interned (a well-known-PHP-string, f.e "php" or "str_replace"),
345345
use an interned string.
346346
* If the string is not read-only and could/should be altered after its been created, do not use an interned string.

Book/php7/zend_engine.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Zend engine
33

44
The Zend engine is a set of components that make PHP what it is. The most important Zend engine component is the
55
*Zend Virtual Machine*, which is composed of the *Zend Compiler* and the *Zend Executor* components. We could also add
6-
the OPCache zend extension in such category. Those three components are the heart of PHP (or the brain, you choose),
6+
the OPcache zend extension in such category. Those three components are the heart of PHP (or the brain, you choose),
77
they are critical and they are the most complex parts of all the PHP source code. In the current chapter, we'll try to
88
open them and detail them.
99

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Zend OPCache
1+
Zend OPcache
22
============

Book/php7/zvals/memory_management.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ until (at least) the end of the request.
6060

6161
There are a number of reasons why immutable strings and arrays exist:
6262

63-
* Any structures stored in opcache shared memory are immutable, because they are shared across multiple processes.
63+
* Any structures stored in OPcache shared memory are immutable, because they are shared across multiple processes.
6464
You can set the ``opcache.protect_memory=1`` ini setting in order to enforce this through ``mprotect()``. This will
6565
make most immutability violations result in crashes rather than misbehavior.
6666
* The empty array is declared ``const`` and as such typically allocated in a read-only segment. Attempting to modify

0 commit comments

Comments
 (0)