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?
/tmp
is mountednoexec
, Dreamhost doesn't appear to use SELinux, in any case the reason isn't important). PHP then displays this message, falls back to non-JIT PCRE, and continues processing with the JIT disabled. That's why this message only appears sometimes and pages otherwise appear normal. The fix is to putpcre.jit=0
intophp.ini
, see my comment on that answer below. – Pinwheel