fooninja.net

Notes on Linux/BSD/Unix and other digital matters

Fixed: "PHP Warning: preg_match_all(): Compilation failed: unrecognized character"

published

When testing a site with Amazon’s Linux AMI on EC2 - which is actually a customized version of RHEL/CentOS - I got this message in a PHP script:

PHP Warning: preg_match_all(): Compilation failed: unrecognized character after (?< at offset 3 in ...

The solution was upgrading the pcre package. The installed version was 6.6-2.6, while the latest official version is 8.10.

If you’re running CentOS/RHEL/Amazon Linux AMI, you can use Jason Litka’s Utter Ramblings yum repository which has 8.x. Follow the instructions on his site and then do yum install pcre. Or, if you set enabled=0 like I did, run yum –enablerepo=utterramblings install pcre.

(For Amazon’s Linux AMI, I also had to change “EL$releasever” to “EL5”, otherwise I got a 404 error.)

Comments