Yapılandırma yönergelerinin kısa açıklamalarını aşağıda bulabilirsiniz.
-
opcache.enable
bool
-
Enables the opcode cache. When disabled, code is not optimised or
cached. The setting opcache.enable
can not be
enabled at runtime through ini_set(), it can only
be disabled. Trying to enable it in a script will generate a warning.
-
opcache.enable_cli
bool
-
Enables the opcode cache for the CLI version of PHP.
-
opcache.memory_consumption
int
-
The size of the shared memory storage used by OPcache, in megabytes.
The minimum permissible value is "8"
,
which is enforced if a smaller value is set.
-
opcache.interned_strings_buffer
int
-
The amount of memory used to store interned strings, in megabytes.
The maximum value is 32767 on 64bit architectures,
and 4095 on 32bit architectures.
Bilginize:
Prior to PHP 8.4.0, the maximum value was 4095 megabytes on all
architectures.
-
opcache.max_accelerated_files
int
-
The maximum number of keys (and therefore scripts) in the OPcache hash
table. The actual value used will be the first number in the set of
prime numbers
{ 223, 463, 983, 1979, 3907, 7963, 16229, 32531, 65407, 130987, 262237, 524521, 1048793 }
that is greater than or equal to the configured value. The minimum value is 200. The maximum
value is 1000000.
Values outside of this range are clamped to the permissible range.
-
opcache.max_wasted_percentage
int
-
The maximum percentage of wasted memory that is allowed before a restart
is scheduled, if there is insufficient free memory.
The maximum permissible value is "50"
,
which is enforced if a larger value is set.
-
opcache.use_cwd
bool
-
If enabled, OPcache appends the current working directory to the script
key, thereby eliminating possible collisions between files with the same
base name. Disabling this directive improves performance, but may break
existing applications.
-
opcache.validate_timestamps
bool
-
If enabled, OPcache will check for updated scripts every
opcache.revalidate_freq
seconds. When this directive is disabled, you must reset OPcache
manually via opcache_reset(),
opcache_invalidate() or by restarting the Web server
for changes to the filesystem to take effect.
Bilginize:
OPcache may still validate the timestamp of a file at compile-time if
opcache.file_update_protection
or opcache.max_file_size
options are set to non-zero values.
-
opcache.revalidate_freq
int
-
How often to check script timestamps for updates, in seconds.
0
will result in OPcache checking for updates on
every request.
This configuration directive is ignored if
opcache.validate_timestamps
is disabled.
-
opcache.revalidate_path
bool
-
If disabled, existing cached files using the same
include_path will be reused.
Thus, if a file with the same name is elsewhere in the include_path, it
won't be found.
-
If disabled, all documentation comments will be discarded from the
opcode cache to reduce the size of the optimised code. Disabling this
configuration directive may break applications and frameworks that rely
on comment parsing for annotations, including Doctrine, Zend Framework 2
and PHPUnit.
-
opcache.fast_shutdown
bool
-
If enabled, a fast shutdown sequence is used that doesn't free each
allocated block, but relies on the Zend Engine memory manager to
deallocate the entire set of request variables en masse.
This directive has been removed in PHP 7.2.0. A variant of the fast
shutdown sequence has been integrated into PHP and will be automatically
used if possible.
-
opcache.enable_file_override
bool
-
When enabled, the opcode cache will be checked for whether a file has
already been cached when file_exists(),
is_file() and is_readable() are
called. This may increase performance in applications that check the
existence and readability of PHP scripts, but risks returning stale data
if
opcache.validate_timestamps
is disabled.
-
opcache.optimization_level
int
-
A bitmask that controls which optimisation passes are executed.
The default is to apply all safe optimizations.
Changing the default is mostly useful for debugging/developing the optimizer
(see also opcache.opt_debug_level).
-
opcache.inherited_hack
bool
-
This configuration directive is ignored.
-
opcache.dups_fix
bool
-
This hack should only be enabled to work around "Cannot redeclare class"
errors.
-
opcache.blacklist_filename
string
-
The location of the OPcache blacklist file. A blacklist file is a text
file containing the names of files that should not be accelerated, one
per line. Wildcards are allowed, and prefixes can also be provided.
Lines starting with a semi-colon are ignored as comments.
A simple blacklist file might look as follows:
-
opcache.max_file_size
int
-
The maximum file size that will be cached, in bytes. If this is
0
, all files will be cached.
-
opcache.consistency_checks
int
-
If non-zero, OPcache will verify the cache checksum every N requests,
where N is the value of this configuration directive. This should only
be enabled when debugging, as it will impair performance.
Bilginize:
Disabled as of 8.1.18 and 8.2.5. Removed as of PHP 8.3.0.
-
opcache.force_restart_timeout
int
-
The length of time to wait for a scheduled restart to begin if the cache
isn't active, in seconds. If the timeout is hit, then OPcache assumes
that something is wrong and will kill the processes holding locks on the
cache to permit a restart.
If
opcache.log_verbosity_level
is set to 2 or above, a warning will be recorded in the error log when
this occurs.
This directive is not supported on Windows.
-
opcache.error_log
string
-
The error log for OPcache errors. An empty string is treated the same as
stderr
, and will result in logs being sent to
standard error (which will be the Web server error log in most cases).
-
opcache.log_verbosity_level
int
-
The log verbosity level. By default, only fatal errors (level 0) and
errors (level 1) are logged. Other levels available are warnings (level
2), information messages (level 3) and debug messages (level 4).
-
opcache.record_warnings
bool
-
If enabled, OPcache will record compile-time warnings and replay them on
the next include, even if it is served from cache.
-
opcache.preferred_memory_model
string
-
The preferred memory model for OPcache to use. If left empty, OPcache
will choose the most appropriate model, which is the correct behaviour
in virtually all cases.
Possible values include mmap
, shm
,
posix
and win32
.
-
opcache.protect_memory
bool
-
Protects shared memory from unexpected writes while executing scripts.
This is useful for internal debugging only.
-
opcache.mmap_base
string
-
The base used for shared memory segments on Windows. All PHP processes
have to map shared memory into the same address space. Using this
directive allows "Unable to reattach to base address" errors to be
fixed.
-
opcache.restrict_api
string
-
Allows calling OPcache API functions only from PHP scripts which path
is started from specified string. The default ""
means no restriction.
-
opcache.file_update_protection
string
-
Prevents caching files that are less than this number of seconds old.
It protects from caching of incompletely updated files. In case all file
updates are atomic, performance can be increased by setting this to 0
.
This will allow files to be cached immediately.
-
opcache.huge_code_pages
bool
-
Enables or disables copying of PHP code (text segment) into HUGE PAGES.
This should improve performance, but requires appropriate OS configuration.
Available on Linux as of PHP 7.0.0, and on FreeBSD as of PHP 7.4.0.
-
opcache.lockfile_path
string
-
Absolute path used to store shared lockfiles (for *nix only)
-
opcache.opt_debug_level
string
-
Produces opcode dumps for debugging different stages of optimizations.
0x10000 will output opcodes as the compiler produced them before any optimization occurs
while 0x20000 will output optimized codes.
-
opcache.file_cache
string
-
Enables and sets the second level cache directory. It should improve
performance when SHM memory is full, at server restart or SHM reset. The
default ""
disables file based caching.
-
opcache.file_cache_only
bool
-
Enables or disables opcode caching in shared memory.
Bilginize:
Prior to PHP 8.1.0, disabling this directive with an already populated
file cache required to manually clear the file cache.
-
opcache.file_cache_consistency_checks
bool
-
Enables or disables checksum validation when script loaded from file cache.
-
opcache.file_cache_fallback
bool
-
Implies opcache.file_cache_only=1
for a certain process that
failed to reattach to shared memory (Windows only). Explicitly enabling
the file cache is required.
Dikkat
Disabling this configuration option may prevent processes to start,
and is therefore discouraged.
-
opcache.validate_permission
bool
-
Validates the cached file permissions against the current user.
-
opcache.validate_root
bool
-
Prevents name collisions in chroot'ed environments. This should be enabled in
all chroot'ed environments to prevent access to files outside the chroot.
-
opcache.preload
string
-
Specifies a PHP script that is going to be compiled and executed at server start-up,
and which may preload other files, either by includeing them or by
using the opcache_compile_file() function. All the entities (e.g.
functions and classes) defined in these files will be available to requests out of
the box, until the server is shut down.
Bilginize:
Preloading is not supported on Windows.
-
opcache.preload_user
string
-
Lets the preloading to be run as the specified system user. This is useful for servers that
startup as root before switching to an unprivileged system user. Preloading as root is not
allowed by default for security reasons, unless this directive is explicitly set to
root
.
-
opcache.cache_id
string
-
On Windows, all processes running the same PHP SAPI
under the same user account having the same cache ID share a single OPcache instance.
The value of the cache ID can be freely chosen.
İpucu
For IIS, different application pools can have their own OPcache instance
by using the environment variable APP_POOL_ID as
opcache.cache_id
.
-
opcache.jit
string|int
-
For typical usage, this option accepts one of four string values:
disable
: Completely disabled, cannot be enabled at runtime.
off
: Disabled, but can be enabled at runtime.
-
tracing
/on
: Use tracing JIT.
Enabled by default and recommended for most users.
function
: Use function JIT.
For advanced usage, this option accepts a 4-digit integer CRTO
, where the digits mean:
C
(CPU-specific optimization flags)
-
0
: Disable CPU-specific optimization.
1
: Enable use of AVX, if the CPU supports it.
R
(register allocation)
-
0
: Don't perform register allocation.
1
: Perform block-local register allocation.
2
: Perform global register allocation.
T
(trigger)
-
0
: Compile all functions on script load.
1
: Compile functions on first execution.
-
2
: Profile functions on first request and compile
the hottest functions afterwards.
3
: Profile on the fly and compile hot functions.
4
: Currently unused.
-
5
: Use tracing JIT. Profile on the fly and
compile traces for hot code segments.
O
(optimization level)
-
0
: No JIT.
1
: Minimal JIT (call standard VM handlers).
2
: Inline VM handlers.
3
: Use type inference.
4
: Use call graph.
5
: Optimize whole script.
The "tracing"
mode corresponds to CRTO = 1254
,
the "function"
mode corresponds to CRTO = 1205
.
-
opcache.jit_buffer_size
int
-
The amount of shared memory to reserve for compiled JIT code. A zero value disables the JIT.
int türünde bir değer kullanıldığında değer baytların
sayısıdır. Büyük bayt değerleri için kullanılabilecek birimlerin gösterimleri
hakkında bilgiyi bu SSS
altında bulabilirsiniz.
-
opcache.jit_debug
int
-
A bit mask specifying which JIT debug output to enable.
For possible values, please consult
» zend_jit.h
(search for macro definitions beginning with ZEND_JIT_DEBUG
).
-
opcache.jit_bisect_limit
int
-
Debugging option that disables JIT compilation after compiling a certain number of functions.
This may be helpful to bisect the source of a JIT miscompilation. Note: this option only works
when JIT trigger is set to 0 (compile on script load) or 1 (compile on first execution),
e.g. opcache.jit=1215
. See more in opcache.jit option.
-
opcache.jit_prof_threshold
float
-
When using the "profile on first request" trigger mode, this threshold determines whether a
function is considered hot. The number of calls to the function divided by the number of calls
to all functions must be above the threshold. For example, a threshold of 0.005 means that
functions that made up more than 0.5% of all calls will be JIT compiled.
-
opcache.jit_max_root_traces
int
-
Maximum number of root traces. The root trace is an execution flow taking one path through the code firstly,
which is a unit of JIT compilation. JIT will not compile new code if it reaches this limit.
-
opcache.jit_max_side_traces
int
-
Maximum number of side traces a root trace may have. The side trace is another execution flow that does not
follow the path of compiled root trace. Side traces belonging to the same root trace will not be compiled
if it reaches this limit.
-
opcache.jit_max_exit_counters
int
-
Maximum number of side trace exit counters. This limits the total number of side traces
there may be, across all root traces.
-
opcache.jit_hot_loop
int
-
After how many iterations a loop is considered hot.
Valid value range is [0,255]
; for any setting out of this range,
e.g. -1
or 256
, default value will be
used instead. 0
will disable JIT to trace and compile any loops.
-
opcache.jit_hot_func
int
-
After how many calls a function is considered hot.
Valid value range is [0,255]
; for any setting out of this range,
e.g. -1
or 256
, default value will be
used instead. 0
will disable JIT to trace and compile any functions.
-
opcache.jit_hot_return
int
-
After how many returns a return is considered hot.
Valid value range is [0,255]
; for any setting out of this range,
e.g. -1
or 256
, default value will be
used instead. 0
will disable JIT to trace and compile any returns.
-
opcache.jit_hot_side_exit
int
-
After how many exits a side exit is considered hot.
Valid value range is [0,255]
; for any setting out of this range,
e.g. -1
or 256
, default value will be
used instead. 0
will disable JIT to trace and compile any side exits.
-
opcache.jit_blacklist_root_trace
int
-
Maximum number of times the compilation of a root trace is attempted before it is blacklisted.
-
opcache.jit_blacklist_side_trace
int
-
Maximum number of times the compilation of a side trace is attempted before it is blacklisted.
-
opcache.jit_max_loop_unrolls
int
-
Maximum number of attempts to unroll a loop in a side trace,
trying to reach the root trace and close the outer loop.
-
opcache.jit_max_recursive_calls
int
-
Maximum number of unrolled recursive call loops.
-
opcache.jit_max_recursive_returns
int
-
Maximum number of unrolled recursive return loops.
-
opcache.jit_max_polymorphic_calls
int
-
Maximum number of attempts to inline polymorphic (dynamic or method) calls.
Calls above this limit are treated as megamorphic and are not inlined.