Name Date Size #Lines LOC

..05-Dec-2019-

Optimizer/H05-Dec-2019-

tests/H05-Dec-2019-

READMEH A D05-Dec-20199.1 KiB231180

ZendAccelerator.cH A D05-Dec-201991 KiB2,8932,312

ZendAccelerator.hH A D05-Dec-201915.1 KiB408330

config.m4H A D05-Dec-20197.5 KiB384338

config.w32H A D05-Dec-2019744 2718

shared_alloc_mmap.cH A D05-Dec-20192.7 KiB7945

shared_alloc_posix.cH A D05-Dec-20193.4 KiB9963

shared_alloc_shm.cH A D05-Dec-20194.7 KiB146100

shared_alloc_win32.cH A D05-Dec-201912.5 KiB392302

zend_accelerator_blacklist.cH A D05-Dec-20199.5 KiB382312

zend_accelerator_blacklist.hH A D05-Dec-20192.2 KiB5021

zend_accelerator_debug.cH A D05-Dec-20192.8 KiB10070

zend_accelerator_debug.hH A D05-Dec-20191.7 KiB349

zend_accelerator_hash.cH A D05-Dec-20197.2 KiB249189

zend_accelerator_hash.hH A D05-Dec-20193.9 KiB9948

zend_accelerator_module.cH A D05-Dec-201933.4 KiB826658

zend_accelerator_module.hH A D05-Dec-20191.5 KiB295

zend_accelerator_util_funcs.cH A D05-Dec-201935.1 KiB1,143915

zend_accelerator_util_funcs.hH A D05-Dec-20192.2 KiB5114

zend_persist.cH A D05-Dec-201922.9 KiB722607

zend_persist.hH A D05-Dec-20191.7 KiB306

zend_persist_calc.cH A D05-Dec-201912.1 KiB375300

zend_shared_alloc.cH A D05-Dec-201913.7 KiB495374

zend_shared_alloc.hH A D05-Dec-20195.9 KiB183122

README

1The Zend OPcache
2================
3
4The Zend OPcache provides faster PHP execution through opcode caching and
5optimization. It improves PHP performance by storing precompiled script
6bytecode in the shared memory. This eliminates the stages of reading code from
7the disk and compiling it on future access. In addition, it applies a few
8bytecode optimization patterns that make code execution faster.
9
10Compatibility
11-------------
12
13This version of Zend OPcache is compatible with PHP 5.2.*, 5.3.*, 5.4.*
14and PHP-5.5 development branch.  PHP 5.2 support may be removed in the future.
15
16Quick Install
17-------------
18
19- Compile
20
21 $PHP_DIR/bin/phpize
22 ./configure \
23      --with-php-config=$PHP_DIR/bin/php-config
24 make
25
26- Install
27
28 make install # this will copy opcache.so into PHP extension directory
29
30- Edit php.ini
31
32 zend_extension=/...full path.../opcache.so
33
34NOTE: In case you are going to use Zend OPcache together with Xdebug or Zend Debugger,
35be sure that the debugger is loaded after OPcache. "php -v" must show the debugger
36after OPcache.
37
38- Restart PHP
39
40Speed Tuning
41-------------
42
43We recommend the following configuration options for best performance
44in a production environment.
45
46opcache.memory_consumption=128
47opcache.interned_strings_buffer=8
48opcache.max_accelerated_files=4000
49opcache.revalidate_freq=60
50opcache.fast_shutdown=1
51opcache.enable_cli=1
52
53You also may add the following, but it may break some applications and
54frameworks. Please, read description of these directives and add them on your
55own risk.
56
57opcache.save_comments=0
58opcache.enable_file_override=1
59
60In some cases you may like to prefer enabling/disabling some features
61to avoid incompatibilities at the cost of some performance degradation.
62
63For development environment we would recommend setting opcache.revalidate_freq
64into 0.
65
66Configuration Directives
67------------------------
68
69opcache.enable (default "1")
70	OPcache On/Off switch. When set to Off, code is not optimized and cached.
71
72opcache.enable_cli (default "0")
73	Enables the OPcache for the CLI version of PHP. It's mostly for testing
74	and debugging.
75
76opcache.memory_consumption (default "64")
77	The OPcache shared memory storage size. The amount of memory for storing
78	precompiled PHP code in Mbytes.
79
80opcache.interned_strings_buffer (default "4")
81	The amount of memory for interned strings in Mbytes.
82
83opcache.max_accelerated_files (default "2000")
84	The maximum number of keys (scripts) in the OPcache hash table.
85	The number is actually the first one in the following set of prime
86	numbers that is bigger than the one supplied: { 223, 463, 983, 1979, 3907,
87	7963, 16229, 32531, 65407, 130987, 262237, 524521, 1048793 }. Only numbers
88	between 200 and 1000000 are allowed.
89
90opcache.max_wasted_percentage (default "5")
91	The maximum percentage of "wasted" memory until a restart is scheduled.
92
93opcache.use_cwd (default "1")
94	When this directive is enabled, the OPcache appends the current working
95	directory to the script key, thus eliminating possible collisions between
96	files with the same name (basename). Disabling the directive improves
97	performance, but may break existing applications.
98
99opcache.validate_timestamps (default "1")
100	When disabled, you must reset the OPcache manually or restart the
101	webserver for changes to the filesystem to take effect.
102	The frequency of the check is controlled by the directive
103	"opcache.revalidate_freq".
104
105opcache.validate_permission (default "0")
106	Leads OPcache to check file readability on each access to cached file.
107	This directive should be enabled in shared hosting environment, when few
108	users (PHP-FPM pools) reuse the common OPcache shared memory.
109
110opcache.validate_root (default "0")
111	This directive prevents file name collisions in different "chroot"
112	environments. It should be enabled for sites that may serve requests in
113	different "chroot" environments.
114
115opcache.revalidate_freq (default "2")
116	How often (in seconds) to check file timestamps for changes to the shared
117	memory storage allocation. ("1" means validate once per second, but only
118	once per request. "0" means always validate)
119
120opcache.file_update_protection (default "2")
121	Prevents caching files that are less than this number of seconds old.
122	It protects from caching of incompletely updated files. In case all file
123	updates on your site are atomic, you may increase performance setting it
124	to "0".
125
126opcache.revalidate_path (default "0")
127	Enables or disables file search in include_path optimization
128	If the file search is disabled and a cached file is found that uses
129	the same include_path, the file is not searched again. Thus, if a file
130	with the same name appears somewhere else in include_path, it
131	won't be found. Enable this directive if this optimization has an effect on
132	your applications. The default for this directive is disabled, which means
133	that optimization is active.
134
135opcache.save_comments (default "1")
136	If disabled, all PHPDoc comments are dropped from the code to reduce the
137	size of the optimized code. Disabling "Doc Comments" may break some
138	existing applications and frameworks (e.g. Doctrine, ZF2, PHPUnit)
139
140opcache.load_comments (default "1")
141	If disabled, PHPDoc comments are not loaded from SHM, so "Doc Comments"
142	may be always stored (save_comments=1), but not loaded by applications
143	that don't need them anyway.
144
145opcache.fast_shutdown (default "0")
146	If enabled, a fast shutdown sequence is used for the accelerated code
147	The fast shutdown sequence doesn't free each allocated block, but lets
148	the Zend Engine Memory Manager do the work.
149
150opcache.enable_file_override (default "0")
151	Allow file existence override (file_exists, etc.) performance feature.
152
153opcache.optimization_level (default "0xffffffff")
154	A bitmask, where each bit enables or disables the appropriate OPcache
155	passes
156
157opcache.inherited_hack (default "1")
158	Enable this hack as a workaround for "can't redeclare class" errors.
159	The OPcache stores the places where DECLARE_CLASS opcodes use
160	inheritance (These are the only opcodes that can be executed by PHP,
161	but which may not be executed because the parent class is missing due to
162	optimization). When the file is loaded, OPcache tries to bind the
163	inherited classes by using the current environment. The problem with this
164	scenario is that, while the DECLARE_CLASS opcode may not be needed for the
165	current script, if the script requires that the opcode at least be defined,
166	it may not run. The default for this directive is disabled, which means
167	that optimization is active. In php-5.3 and above this hack is not needed
168	anymore and this setting has no effect.
169
170opcache.dups_fix (default "0")
171	Enable this hack as a workaround for "Cannot redeclare class" errors.
172
173opcache.blacklist_filename
174	The location of the OPcache blacklist file (wildcards allowed).
175	Each OPcache blacklist file is a text file that holds the names of files
176	that should not be accelerated. The file format is to add each filename
177	to a new line. The filename may be a full path or just a file prefix
178	(i.e., /var/www/x  blacklists all the files and directories in /var/www
179	that start with 'x'). Line starting with a ; are ignored (comments).
180	Files are usually triggered by one of the following three reasons:
181	1) Directories that contain auto generated code, like Smarty or ZFW cache.
182	2) Code that does not work well when accelerated, due to some delayed
183	   compile time evaluation.
184	3) Code that triggers an OPcache bug.
185
186opcache.max_file_size (default "0")
187	Allows exclusion of large files from being cached. By default all files
188	are cached.
189
190opcache.consistency_checks (default "0")
191	Check the cache checksum each N requests.
192	The default value of "0" means that the checks are disabled.
193	Because calculating the checksum impairs performance, this directive should
194	be enabled only as part of a debugging process.
195
196opcache.force_restart_timeout (default "180")
197	How long to wait (in seconds) for a scheduled restart to begin if the cache
198	is not being accessed.
199	The OPcache uses this directive to identify a situation where there may
200	be a problem with a process. After this time period has passed, the
201	OPcache assumes that something has happened and starts killing the
202	processes that still hold the locks that are preventing a restart.
203	If the log level is 3 or above, a "killed locker" error is recorded
204	in the Apache logs when this happens.
205
206opcache.error_log
207	OPcache error_log file name. Empty string assumes "stderr".
208
209opcache.log_verbosity_level (default "1")
210	All OPcache errors go to the Web server log.
211	By default, only fatal errors (level 0) or errors (level 1) are logged.
212	You can also enable warnings (level 2), info messages (level 3) or
213	debug messages (level 4).
214
215opcache.preferred_memory_model
216	Preferred Shared Memory back-end. Leave empty and let the system decide.
217
218opcache.protect_memory (default "0")
219	Protect the shared memory from unexpected writing during script execution.
220	Useful for internal debugging only.
221
222opcache.restrict_api (default "")
223	Allows calling OPcache API functions only from PHP scripts which path is
224	started from specified string. The default "" means no restriction.
225
226opcache.mmap_base
227	Mapping base of shared memory segments (for Windows only). All the PHP
228	processes have to map shared memory into the same address space. This
229	directive allows to manually fix the "Unable to reattach to base address"
230	errors.
231