Dear friends, this is a strange problem that the younger brother encountered when using preg_match_all. when I used preg_match_all to match a long string, apache will crash and display the page loading failure.
Later, I checked it online and said it was about
Ini_set ('pcre. backtrack_limit ', 999999999 );
Ini_set ('pcre. recursion_limit ', 99999 );
But I found that it was useless. after a long time, I could not solve the problem. please kindly advise me.
The following link is my reference. the above two solutions are also copied from the following link.
Http://www.php230.com/1410840481.html
Reply to discussion (solution)
So what are your rule strings and text to be matched?
Everything has a degree. if it exceeds the limit, problems will naturally occur.
For example, if the number of backward references is not greater than 9, ambiguity may occur if the number of references exceeds 9.
The Text type of the database can only store 64 k content. this factor is also taken into account when the preg function is implemented. it is also a waste to reserve a large table space for State transfer.
So what are your rule strings and text to be matched?
Everything has a degree. if it exceeds the limit, problems will naturally occur.
For example, if the number of backward references is not greater than 9, ambiguity may occur if the number of references exceeds 9.
The Text type of the database can only store 64 k content. this factor is also taken into account when the preg function is implemented. it is also a waste to reserve a large table space for State transfer.
I learned... PHP accuracy is a big problem.
So what are your rule strings and text to be matched?
Everything has a degree. if it exceeds the limit, problems will naturally occur.
For example, if the number of backward references is not greater than 9, ambiguity may occur if the number of references exceeds 9.
The Text type of the database can only store 64 k content. this factor is also taken into account when the preg function is implemented. it is also a waste to reserve a large table space for State transfer.
The regular expression is like this.
$pattern = '/\{(\{(\w+)(?:(?!\{\{).|\n)+\{\/\2\})\}/';
The string is:
TODO supply a title
{{foreach ($message1 as $key1 => $value1)} {$key1} => {foreach ($value1 as $key2 => $value2)} {foreach ($value2 as $key3 => $value3)} {if($value3 == 0)} {$key3}=>female
{else if($value3 == 1)} {$key3}=>male
{else} {$key3}=>{$value3}
{/if} {/foreach} {/foreach} {/foreach}}
So what are your rule strings and text to be matched?
Everything has a degree. if it exceeds the limit, problems will naturally occur.
For example, if the number of backward references is not greater than 9, ambiguity may occur if the number of references exceeds 9.
The Text type of the database can only store 64 k content. this factor is also taken into account when the preg function is implemented. it is also a waste to reserve a large table space for State transfer.
The regular expression is like this.
$pattern = '/\{(\{(\w+)(?:(?!\{\{).|\n)+\{\/\2\})\}/';
The string is:
TODO supply a title
{{foreach ($message1 as $key1 => $value1)} {$key1} => {foreach ($value1 as $key2 => $value2)} {foreach ($value2 as $key3 => $value3)} {if($value3 == 0)} {$key3}=>female
{else if($value3 == 1)} {$key3}=>male
{else} {$key3}=>{$value3}
{/if} {/foreach} {/foreach} {/foreach}}
preg_match_all($pattern, $this->content, $matches);
$ This-> content is the content of the above string. when preg_match_all is run, the program crashes.
So what are your rule strings and text to be matched?
Everything has a degree. if it exceeds the limit, problems will naturally occur.
For example, if the number of backward references is not greater than 9, ambiguity may occur if the number of references exceeds 9.
The Text type of the database can only store 64 k content. this factor is also taken into account when the preg function is implemented. it is also a waste to reserve a large table space for State transfer.
The regular expression is like this.
$pattern = '/\{(\{(\w+)(?:(?!\{\{).|\n)+\{\/\2\})\}/';
The string is:
TODO supply a title
{{foreach ($message1 as $key1 => $value1)} {$key1} => {foreach ($value1 as $key2 => $value2)} {foreach ($value2 as $key3 => $value3)} {if($value3 == 0)} {$key3}=>female
{else if($value3 == 1)} {$key3}=>male
{else} {$key3}=>{$value3}
{/if} {/foreach} {/foreach} {/foreach}}
preg_match_all($pattern, $this->content, $matches);
$ This-> content is the content of the above string. when preg_match_all is run, the program crashes.
Additionally, this regular expression matches the content of {foreach...}... {/foreach }.
In addition, after I tested it, I cut the length of the above string into the following, so that preg_match_all can run normally,
TODO supply a title
{{foreach ($message1 as $key1 => $value1)} {$key1} => {foreach ($value1 as $key2 => $value2)} {foreach ($value2 as $key3 => $value3)} {$key3}=>{$value3}
{/foreach} {/foreach} {/foreach}}
However, if it is cut short, it will not be able to meet my needs. please give me some advice.