JOOMLA · PHP
How to Resolve PHP REGULAR EXPRESSION LIMIT REACHED Error in Joomla
Learn how to fix the 500 PHP REGULAR EXPRESSION LIMIT REACHED (PCRE.BACKTRACK_LIMIT) error in Joomla by adding lines of code to the configuration file or php.ini.
To solve if you come across the message -> Error: 500 PHP REGULAR EXPRESSION LIMIT REACHED (PCRE.BACKTRACK_LIMIT) in your Joomla, just add the lines below in the index.php or configuration.php file of the application installation on your hosting.
Note: Insert the lines of code right after opening the php tag in the file.
ini_set('pcre.backtrack_limit',1000000);
ini_set('pcre.recursion_limit',1000000);
If you have access to php.ini it is even better, as you just need to change the values in the file.
See more in the documentation -> http://php.net/manual/en/pcre.configuration.php
In mine it worked without problems. In case of doubts, leave your comment.
Thx!
Revisited in November 2026
Two things worth knowing before copying these lines today:
- Since PHP 5.3.7, the default value of
pcre.backtrack_limitis already 1000000. On any current PHP, the first line changes nothing. It made a difference back then because a lot of hosting still ran versions with the old default, 100000. pcre.recursion_limitdefaults to 100000, and the PHP manual warns that a high value may consume all the process stack and crash PHP. Raising it to 1000000 can swap the error message for a crash with no message at all.
If the error shows up on a current PHP, the most useful step is finding which extension or plugin is running the heavy regular expression, usually over a very large text, instead of just raising the limits.
Who writes this
Eduardo Lira
Software developer in Rio de Janeiro. I started this blog in 2012, in technical support at a hosting company, writing down the fixes for the problems that came up every day. Today I work at Sofis Tecnologia, on critical healthcare systems and SQL Server database migrations.