I'm transitioning my website from PHP v.5 installed on a shared web-hosting account (at DreamHost) to run on PHP 7.3.11. After transition, I started noticing that once in a while I get these warnings:
Warning: preg_match_all(): Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0
The last one originated from this line of code that was supposed to replace special tags in my posted HTML for the page:
if(preg_match_all("/\[".$tagBegin."(\S)+\]/U", $html, $matches, PREG_OFFSET_CAPTURE) !== false)
Is there something that I need to do differently in v.7.3 to avoid that warning?
You should be able to ward off this warning by using ini_set
to change the config value suggested by the warning message itself:
ini_set("pcre.jit", "0");
Be sure to run that line of code before any usages of regular expressions.
For me I have added pcre.jit=0
to php.ini file in [Pcre]
and this worked very nice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With