Programing/WEB

[PHP] preg_match_all 에러

진 주 2020. 2. 4. 17:38

입력스트링값이 너무 길어지면 값을 못받아오는 문제 발생

 

해결방법

php.ini

[Pcre]
;PCRE library backtracking limit.
;pcre.backtrack_limit=100000

;PCRE library recursion limit.
;Please note that if you set this value to a high number you may consume all
;the available process stack and eventually crash PHP (due to reaching the
;stack size limit imposed by the Operating System).
;pcre.recursion_limit=100000

 

pcre.backtrack_limit 항목의 주석해제

 

소스

ini_set('pcre.backtrack_limit', 원하는값);

소스 상단에 추가