php preg_replace problem with large files/strings – fails silently

Martin Zeller php 0 Comments

If you have a problem with preg_replace or other PCRE functions in php, because they fail  silently, without error message or other feedback, especially with large strings, then have a look at this php.ini setting:

pcre.backtrack_limit

For example, modify the value in your php script:

ini_set('pcre.backtrack_limit', '100000000');

Just increase the default value of 1.000.000. Maybe you have to increase the value for memory_limit as well.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.