Error when using REGEXP in mysql

If you face this issue "exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1139 Got error 'this version of PCRE is compiled without UTF support at offset 0' from regexp'"

It means your web server doesn't support UTF-8.

I had the same error after an upgrade from ubuntu 14.04 to 16.04.

I'm using lampp 5.6.20 and had the same error in the requests using REGEXP.

With the below command, I detected this lib doens't have UTF-8 support:

$ /opt/lampp/bin/pcretest -C

No UTF-8 support

I found that I must recompile my lampp PCRE with these options:

--enable-utf8 --enable-unicode-properties

To do that I downloaded pcre-8.38 and in the extracted folder I executed the next command:

$ ./configure --enable-utf8 --enable-unicode-properties
$ make
$ sudo make install

Then I copied all generated files in the .libs folder to the /opt/lampp/lib folder :

$ sudo cp .libs/* /opt/lampp/lib

Then confirmed support for UTF-8:

$ /opt/lampp/bin/pcretest -C

UTF-8 support

Lastly I restarted my lampp (to restart mysql or MariaDB) :

$ sudo /opt/lampp/lampp restart


No comments yet.

Leave a Reply