A string of about KB, which is a number + delimiter. Because it is submitted by the user, check whether it is legal. Here, I use preg_match_all + Regular Expression to detect strings. When strings are short, they can be detected. No problem occurs. When strings exceed kb, nginx will be 502. I also found the problem... A string of about KB, which is a number + delimiter. Because it is submitted by the user, check whether it is legal. I use preg_match_all + Regular Expression to detect short strings. It can be checked. No problem occurs. When the string exceeds 502 KB, nginx will be
I also found the problem, and set the Backtracking value in pcre.
Later, based on the solution provided on the internet
ini_set("pcre.backtrack_limit",1000000);
Still 502
The regular code is:
/^(\d{5}(&|$)){1,}$/
The string format is:
12345&12346&12347&……99999
Is there any other way to solve this problem?
Or where is my configuration incorrect?
Reply content:
A string of about KB, which is a number + delimiter. Because it is submitted by the user, check whether it is legal. I use preg_match_all + Regular Expression to detect short strings. It can be checked. No problem occurs. When the string exceeds 502 KB, nginx will be
I also found the problem, and set the Backtracking value in pcre.
Later, based on the solution provided on the internet
ini_set("pcre.backtrack_limit",1000000);
Still 502
The regular code is:
/^(\d{5}(&|$)){1,}$/
The string format is:
12345&12346&12347&……99999
Is there any other way to solve this problem?
Or where is my configuration incorrect?
Even ifpcre.backtrack_limit
It is still possible to crash, because a huge rollback may result in stack explosion, which is a system-level restriction,PHP
Or left or right. We recommend that you use other methods to process the content. For example, split the content first and check each segment in a loop.