Name Date Size #Lines LOC

..05-Dec-2019-

Optimizer/H05-Dec-2019-

tests/H05-Dec-2019-

READMEH A D05-Dec-20198.7 KiB221172

ZendAccelerator.cH A D05-Dec-201988.6 KiB2,8062,229

ZendAccelerator.hH A D05-Dec-201914.8 KiB399321

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-201911.1 KiB345264

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-20196.8 KiB225165

zend_accelerator_hash.hH A D05-Dec-20193.9 KiB9948

zend_accelerator_module.cH A D05-Dec-201932.7 KiB814646

zend_accelerator_module.hH A D05-Dec-20191.5 KiB295

zend_accelerator_util_funcs.cH A D05-Dec-201933.3 KiB1,076852

zend_accelerator_util_funcs.hH A D05-Dec-20192.2 KiB5114

zend_persist.cH A D05-Dec-201921.9 KiB685572

zend_persist.hH A D05-Dec-20191.7 KiB306

zend_persist_calc.cH A D05-Dec-201911.4 KiB346273

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.revalidate_freq (default "2")
106	How often (in seconds) to check file timestamps for changes to the shared
107	memory storage allocation. ("1" means validate once per second, but only
108	once per request. "0" means always validate)
109
110opcache.file_update_protection (default "2")
111	Prevents caching files that are less than this number of seconds old.
112	It protects from caching of incompletely updated files. In case all file
113	updates on your site are atomic, you may increase performance setting it
114	to "0".
115
116opcache.revalidate_path (default "0")
117	Enables or disables file search in include_path optimization
118	If the file search is disabled and a cached file is found that uses
119	the same include_path, the file is not searched again. Thus, if a file
120	with the same name appears somewhere else in include_path, it
121	won't be found. Enable this directive if this optimization has an effect on
122	your applications. The default for this directive is disabled, which means
123	that optimization is active.
124
125opcache.save_comments (default "1")
126	If disabled, all PHPDoc comments are dropped from the code to reduce the
127	size of the optimized code. Disabling "Doc Comments" may break some
128	existing applications and frameworks (e.g. Doctrine, ZF2, PHPUnit)
129
130opcache.load_comments (default "1")
131	If disabled, PHPDoc comments are not loaded from SHM, so "Doc Comments"
132	may be always stored (save_comments=1), but not loaded by applications
133	that don't need them anyway.
134
135opcache.fast_shutdown (default "0")
136	If enabled, a fast shutdown sequence is used for the accelerated code
137	The fast shutdown sequence doesn't free each allocated block, but lets
138	the Zend Engine Memory Manager do the work.
139
140opcache.enable_file_override (default "0")
141	Allow file existence override (file_exists, etc.) performance feature.
142
143opcache.optimization_level (default "0xffffffff")
144	A bitmask, where each bit enables or disables the appropriate OPcache
145	passes
146
147opcache.inherited_hack (default "1")
148	Enable this hack as a workaround for "can't redeclare class" errors.
149	The OPcache stores the places where DECLARE_CLASS opcodes use
150	inheritance (These are the only opcodes that can be executed by PHP,
151	but which may not be executed because the parent class is missing due to
152	optimization). When the file is loaded, OPcache tries to bind the
153	inherited classes by using the current environment. The problem with this
154	scenario is that, while the DECLARE_CLASS opcode may not be needed for the
155	current script, if the script requires that the opcode at least be defined,
156	it may not run. The default for this directive is disabled, which means
157	that optimization is active. In php-5.3 and above this hack is not needed
158	anymore and this setting has no effect.
159
160opcache.dups_fix (default "0")
161	Enable this hack as a workaround for "Cannot redeclare class" errors.
162
163opcache.blacklist_filename
164	The location of the OPcache blacklist file (wildcards allowed).
165	Each OPcache blacklist file is a text file that holds the names of files
166	that should not be accelerated. The file format is to add each filename
167	to a new line. The filename may be a full path or just a file prefix
168	(i.e., /var/www/x  blacklists all the files and directories in /var/www
169	that start with 'x'). Line starting with a ; are ignored (comments).
170	Files are usually triggered by one of the following three reasons:
171	1) Directories that contain auto generated code, like Smarty or ZFW cache.
172	2) Code that does not work well when accelerated, due to some delayed
173	   compile time evaluation.
174	3) Code that triggers an OPcache bug.
175
176opcache.max_file_size (default "0")
177	Allows exclusion of large files from being cached. By default all files
178	are cached.
179
180opcache.consistency_checks (default "0")
181	Check the cache checksum each N requests.
182	The default value of "0" means that the checks are disabled.
183	Because calculating the checksum impairs performance, this directive should
184	be enabled only as part of a debugging process.
185
186opcache.force_restart_timeout (default "180")
187	How long to wait (in seconds) for a scheduled restart to begin if the cache
188	is not being accessed.
189	The OPcache uses this directive to identify a situation where there may
190	be a problem with a process. After this time period has passed, the
191	OPcache assumes that something has happened and starts killing the
192	processes that still hold the locks that are preventing a restart.
193	If the log level is 3 or above, a "killed locker" error is recorded
194	in the Apache logs when this happens.
195
196opcache.error_log
197	OPcache error_log file name. Empty string assumes "stderr".
198
199opcache.log_verbosity_level (default "1")
200	All OPcache errors go to the Web server log.
201	By default, only fatal errors (level 0) or errors (level 1) are logged.
202	You can also enable warnings (level 2), info messages (level 3) or
203	debug messages (level 4).
204
205opcache.preferred_memory_model
206	Preferred Shared Memory back-end. Leave empty and let the system decide.
207
208opcache.protect_memory (default "0")
209	Protect the shared memory from unexpected writing during script execution.
210	Useful for internal debugging only.
211
212opcache.restrict_api (default "")
213	Allows calling OPcache API functions only from PHP scripts which path is
214	started from specified string. The default "" means no restriction.
215
216opcache.mmap_base
217	Mapping base of shared memory segments (for Windows only). All the PHP
218	processes have to map shared memory into the same address space. This
219	directive allows to manually fix the "Unable to reattach to base address"
220	errors.
221