pcre.backtrack_limit defaults to 100k. This is rather conservative.
It is limited by RAM size, not the ulimit on stack-size.
On a (2009-era) netbook, I can set pcre.backtrack_limit to 100 million, and the regex will happily process a 90 million character string in about 3 seconds. YMMV.
Configuración en tiempo de ejecución
El comportamiento de estas funciones se ve afectado por la configuración de php.ini.
| Nombre | Por defecto | Cambiable | Historial de cambios |
|---|---|---|---|
| pcre.backtrack_limit | "1000000" | PHP_INI_ALL | Disponible a partir de PHP 5.2.0. |
| pcre.recursion_limit | "100000" | PHP_INI_ALL | Disponible a partir de PHP 5.2.0. |
He aquí una breve explicación de las directivas de configuración.
-
pcre.backtrack_limitinteger -
Límite de marcha atrás de PCRE. Por defecto es 100000 para PHP < 5.3.7.
-
pcre.recursion_limitinteger -
Límite de recursividad de PCRE. Por favor, observe que si establece este valor con un número alto puede consumir toda la pila de procesos disponibles y al final provocar que se cuelgue PHP (debido a alcanzar el límite del tamaño de la pila impuesto por el Sistema Operativo).
php at richardneill dot org ¶
2 years ago
chris at ocproducts dot com ¶
2 years ago
pcre.backtrack_limit sets the maximum bind length PREG calls (e.g. preg_replace_callback) can make. However the actual maximum seems to be approximately half the value set here, possibly due to the character encoding that PCRE runs with internally.
