El comportamiento de estas funciones es afectado por la configuración en el archivo php.ini.
| Nombre | Por defecto | Cambiable | Historial de cambios |
|---|---|---|---|
| opcache.enable | 1 | INI_ALL |
|
| opcache.enable_cli | 0 | INI_SYSTEM |
Entre PHP 7.1.2 y 7.1.6 inclusive, el valor por omisión era 1 |
| opcache.memory_consumption | "128" | INI_SYSTEM |
|
| opcache.interned_strings_buffer | "8" | INI_SYSTEM |
|
| opcache.max_accelerated_files | "10000" | INI_SYSTEM |
|
| opcache.max_wasted_percentage | "5" | INI_SYSTEM |
|
| opcache.use_cwd | 1 | INI_SYSTEM |
|
| opcache.validate_timestamps | 1 | INI_ALL |
|
| opcache.revalidate_freq | "2" | INI_ALL |
|
| opcache.revalidate_path | 0 | INI_ALL |
|
| opcache.save_comments | 1 | INI_SYSTEM |
|
| opcache.fast_shutdown | 0 | INI_SYSTEM |
Eliminado en PHP 7.2.0. |
| opcache.enable_file_override | 0 | INI_SYSTEM |
|
| opcache.optimization_level | "0x7FFEBFFF" | INI_SYSTEM |
Modificado desde 0x7FFFBFFF en PHP 7.3.0 |
| opcache.inherited_hack | 1 | INI_SYSTEM |
Eliminado en PHP 7.3.0 |
| opcache.dups_fix | 0 | INI_ALL |
|
| opcache.blacklist_filename | "" | INI_SYSTEM |
|
| opcache.max_file_size | 0 | INI_SYSTEM |
|
| opcache.consistency_checks | 0 | INI_ALL |
>Desactivado a partir de PHP 8.1.18 y 8.2.5. Eliminado a partir de PHP 8.3.0. |
| opcache.force_restart_timeout | "180" | INI_SYSTEM |
|
| opcache.error_log | "" | INI_SYSTEM |
|
| opcache.log_verbosity_level | 1 | INI_SYSTEM |
|
| opcache.record_warnings | 0 | INI_SYSTEM |
Disponible a partir de PHP 8.0.0. |
| opcache.preferred_memory_model | "" | INI_SYSTEM |
|
| opcache.protect_memory | 0 | INI_SYSTEM |
|
| opcache.mmap_base | null |
INI_SYSTEM |
|
| opcache.restrict_api | "" | INI_SYSTEM |
|
| opcache.file_update_protection | "2" | INI_ALL |
|
| opcache.huge_code_pages | 0 | INI_SYSTEM |
|
| opcache.lockfile_path | "/tmp" | INI_SYSTEM |
|
| opcache.opt_debug_level | 0 | INI_SYSTEM |
Disponible a partir de PHP 7.1.0 |
| opcache.file_cache | NULL | INI_SYSTEM |
|
| opcache.file_cache_only | 0 | INI_SYSTEM |
|
| opcache.file_cache_consistency_checks | 1 | INI_SYSTEM |
|
| opcache.file_cache_fallback | 1 | INI_SYSTEM |
Solo para Windows. |
| opcache.validate_permission | 0 | INI_SYSTEM |
Disponible a partir de PHP 7.0.14 |
| opcache.validate_root | 0 | INI_SYSTEM |
Disponible a partir de PHP 7.0.14 |
| opcache.preload | "" | INI_SYSTEM |
Disponible a partir de PHP 7.4.0 |
| opcache.preload_user | "" | INI_SYSTEM |
Disponible a partir de PHP 7.4.0 |
| opcache.cache_id | "" | INI_SYSTEM |
Solo para Windows. Disponible a partir de PHP 7.4.0 |
| opcache.jit | "disable" | INI_ALL |
Disponible a partir de PHP 8.0.0. Antes de PHP 8.4.0, el valor predeterminado era "tracing". |
| opcache.jit_buffer_size | 64M | INI_SYSTEM |
Disponible a partir de PHP 8.0.0. Antes de PHP 8.4.0, el valor predeterminado era 0. |
| opcache.jit_debug | 0 | INI_ALL |
Disponible a partir de PHP 8.0.0 |
| opcache.jit_bisect_limit | 0 | INI_ALL |
Disponible a partir de PHP 8.0.0 |
| opcache.jit_prof_threshold | "0.005" | INI_ALL |
Disponible a partir de PHP 8.0.0 |
| opcache.jit_max_root_traces | "1024" | INI_SYSTEM |
Disponible a partir de PHP 8.0.0 |
| opcache.jit_max_side_traces | "128" | INI_SYSTEM |
Disponible a partir de PHP 8.0.0 |
| opcache.jit_max_exit_counters | "8192" | INI_SYSTEM |
Disponible a partir de PHP 8.0.0 |
| opcache.jit_hot_loop | "64" | INI_SYSTEM |
Disponible a partir de PHP 8.0.0 |
| opcache.jit_hot_func | "127" | INI_SYSTEM |
Disponible a partir de PHP 8.0.0 |
| opcache.jit_hot_return | "8" | INI_SYSTEM |
Disponible a partir de PHP 8.0.0 |
| opcache.jit_hot_side_exit | "8" | INI_SYSTEM |
Disponible a partir de PHP 8.0.0 |
| opcache.jit_blacklist_root_trace | "16" | INI_ALL |
Disponible a partir de PHP 8.0.0 |
| opcache.jit_blacklist_side_trace | "8" | INI_ALL |
Disponible a partir de PHP 8.0.0 |
| opcache.jit_max_loop_unrolls | "8" | INI_ALL |
Disponible a partir de PHP 8.0.0 |
| opcache.jit_max_recursive_calls | "2" | INI_ALL |
Disponible a partir de PHP 8.0.0 |
| opcache.jit_max_recursive_returns | "2" | INI_ALL |
Disponible a partir de PHP 8.0.0 |
| opcache.jit_max_polymorphic_calls | "2" | INI_ALL |
Disponible a partir de PHP 8.0.0 |
Aquí hay una aclaración sobre el uso de las directivas de configuración.
opcache.enable
bool
opcache.enable
no puede ser activada durante la ejecución mediante la función
ini_set(), solo puede ser desactivada. Intentar activarla
en un script generará una advertencia.
opcache.enable_cli
bool
opcache.memory_consumption
int
"8",
que se fuerza si se define un valor más pequeño.
opcache.interned_strings_buffer
int
Nota: Antes de PHP 8.4.0, el valor máximo era de 4095 megabytes en todas las arquitecturas.
opcache.max_accelerated_files
int
{ 223, 463, 983, 1979, 3907, 7963, 16229, 32531, 65407, 130987, 262237, 524521, 1048793 }
que sea mayor o igual que el valor configurado. El valor mínimo es 200.
El valor máximo es 100000 en PHP < 5.5.6, y 1000000 en versiones
posteriores.
Los valores fuera de este intervalo se ajustan al intervalo permitido.
opcache.max_wasted_percentage
int
"50",
que se fuerza si se define un valor más grande.
opcache.use_cwd
bool
opcache.validate_timestamps
bool
Si está activado, OPcache verificará las actualizaciones de los scripts cada opcache.revalidate_freq segundos. Cuando esta directiva está desactivada, debe reinicializarse OPcache manualmente mediante la función opcache_reset(), la función opcache_invalidate() o reiniciando el servidor web para que los cambios en el sistema de archivos surtan efecto.
Nota: OPcache puede validar siempre el timestamp de un archivo durante la compilación si las opciones opcache.file_update_protection o opcache.max_file_size están definidas en valores no nulos.
opcache.revalidate_freq
int
0
hará que OPcache verifique las actualizaciones en cada petición.
Esta directiva de configuración se ignora si
opcache.validate_timestamps
está desactivado.
opcache.revalidate_path
bool
opcache.save_comments
bool
opcache.fast_shutdown
bool
opcache.enable_file_override
bool
opcache.optimization_level
int
opcache.inherited_hack
bool
opcache.dups_fix
bool
opcache.blacklist_filename
string
; Coincide con un archivo específico. /var/www/broken.php ; Un prefijo que coincide con todos los archivos que comienzan con x. /var/www/x ; Una coincidencia con comodín. /var/www/*-broken.php
opcache.max_file_size
int
0, todos los archivos podrán ser almacenados en caché.
opcache.consistency_checks
int
Nota: Desactivado a partir de PHP 8.1.18 y 8.2.5. Eliminado a partir de PHP 8.3.0.
opcache.force_restart_timeout
int
opcache.error_log
string
stderr, y los errores serán enviados a la salida
estándar de errores (que será el registro de errores del servidor web en la
mayoría de los casos).
opcache.log_verbosity_level
int
opcache.record_warnings
bool
opcache.preferred_memory_model
string
mmap, shm,
posix y win32.
opcache.protect_memory
bool
opcache.mmap_base
string
opcache.restrict_api
string
opcache.file_update_protection
string
0.
Esto permitirá almacenar en caché los archivos inmediatamente.
opcache.huge_code_pages
bool
opcache.lockfile_path
string
opcache.opt_debug_level
string
opcache.file_cache
string
opcache.file_cache_only
bool
Nota: Antes de PHP 8.1.0, desactivar esta directiva con un archivo de caché ya lleno requiere el vaciado manual de la caché.
opcache.file_cache_consistency_checks
bool
opcache.file_cache_fallback
bool
Desactivar esta opción de configuración puede impedir que los procesos se inicien, y por lo tanto se desaconseja.
opcache.validate_permission
bool
opcache.validate_root
bool
opcache.preload
string
Nota: El precargado no es soportado en Windows.
opcache.preload_user
string
root.
A partir de PHP 8.3.0, esta directiva ya no necesita ser definida para permitir el precargado
al ejecutarse como root con CLI SAPI o phpdbg SAPI.
opcache.cache_id
string
En Windows, todos los procesos que ejecutan el mismo PHP SAPI bajo el mismo usuario con el mismo ID de caché comparten una instancia única de OPcache. El valor del ID de caché puede ser elegido libremente.
Para IIS, diferentes grupos de aplicaciones pueden tener su propia
instancia OPcache utilizando la variable de entorno
APP_POOL_ID como opcache.cache_id.
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
disable: Desactivado completamente, no puede ser activado durante el tiempo de ejecución.off: Desactivado, pero puede ser activado durante el tiempo de ejecución.tracing/on: Utiliza el tracing JIT.
Activado por omisión y recomendado para la mayoría de los usuarios.
function: Utiliza el function JIT.
Para un uso avanzado, esta opción acepta un entero de 4 dígitos
CRTO, donde los dígitos significan:
C (Banderas de optimización específica del CPU)0: Desactiva las optimizaciones específicas del CPU.1: Activa el uso de AVX, si el CPU lo soporta.R (asignación de registros)0: No realiza ninguna asignación de registros1: Realiza asignaciones de registros a nivel de bloque.2: Realiza asignaciones de registros globales.T (disparador)0: Compila todas las funciones al cargar el script.1: Compila las funciones en su primera ejecución.2: Perfila las funciones en la primera petición y compila las funciones
más calientes justo después.
3: Perfila a la volada y compila las funciones calientes.4: Actualmente no utilizado.5: Utiliza el tracing JIT. Perfila a la volada y
compila las trazas para los segmentos de código caliente.
O (nivel de optimización)0: Sin JIT.1: JIT mínimo (llama a los manejadores estándar de la VM).2: Inlinea los manejadores de la VM.3: Utiliza la inferencia de tipos.4: Utiliza un grafo de llamadas.5: Optimiza el script entero."tracing" corresponde a CRTO = 1254,
el modo "function" corresponde a CRTO = 1205.
opcache.jit_buffer_size
int
opcache.jit_debug
int
ZEND_JIT_DEBUG).
opcache.jit_bisect_limit
int
opcache.jit=1215.
Ver más en la opción opcache.jit.
opcache.jit_prof_threshold
float
opcache.jit_max_root_traces
int
opcache.jit_max_side_traces
int
opcache.jit_max_exit_counters
int
opcache.jit_hot_loop
int
[0,255] ;
para cualquier parámetro fuera de este rango, por ejemplo -1 o 256, se utilizará el valor por omisión en su lugar.
Especialmente, un valor nulo desactivará el JIT para trazar y compilar todos los bucles.
opcache.jit_hot_func
int
[0,255] ;
para cualquier parámetro fuera de este rango, por ejemplo -1 o 256, se utilizará el valor por omisión en su lugar.
Especialmente, un valor nulo desactivará el JIT para trazar y compilar todas las funciones.
opcache.jit_hot_return
int
[0,255] ;
para cualquier parámetro fuera de este rango, por ejemplo -1 o 256, se utilizará el valor por omisión en su lugar.
Especialmente, un valor nulo desactivará el JIT para trazar y compilar todos los retornos.
opcache.jit_hot_side_exit
int
[0,255] ;
para cualquier parámetro fuera de este rango, por ejemplo -1 o 256, se utilizará el valor por omisión en su lugar.
Especialmente, un valor nulo desactivará el JIT para trazar y compilar todas las salidas laterales.
opcache.jit_blacklist_root_trace
int
opcache.jit_blacklist_side_trace
int
opcache.jit_max_loop_unrolls
int
opcache.jit_max_recursive_calls
int
opcache.jit_max_recursive_returns
int
opcache.jit_max_polymorphic_calls
int