I recently ran into an obscure issue with PHP's preg functions: Exception: preg_match(): Compilation failed: unknown option bit(s) set at offset 0 This error message would show up whenever a PCRE function was used with the u (unicode/UTF-8) flag set. This is apparently triggered by using a new version of PHP (>5.3?) and an old version of libpcre (<8.1?). The only solutions I could find on the 'net were:
  • old version of PCRE is lying around, get rid of it (no, both Portage and php -i | grep -i pcre reassured me this was not the case)
  • PCRE and/or PHP needs to be recompiled for UTF-8 support (I see no such options in the packages and have to assume they're on by default in Gentoo)
  • PHP needs to be recompiled because PCRE was upgraded after it (this made sense, but genlop -lu ,| grep -E '(pcre|php)' assured me the proper order had been followed)
But guess what? One emerge -1 libpcre php and one /etc/init.d/apache2 restart later (though it occurred to me maybe I hadn't done that previously! Try it yourself, maybe that's why you're getting this!), and I was good to go. Sometimes, you just have to double-check.
(Comments currently disabled; Please comment on social media for now or using the contact form.)