php preg_replace problem with large files/strings – fails silently

Martin Zellerphp Leave a Comment

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:

[php] ini_set(‘pcre.backtrack_limit’, ‘100000000’);
[/php]

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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.