解决Mysql报错'this version of PCRE is compiled without UTF support at offset 0'(XAMPP)

导语:春叶主题运行在测试环境时,高级搜索功能没有问题,当移植到正式环境的时候,运行时Mysql出现了’this version of PCRE is compiled without UTF support at offset 0’的错误。

开启WordPress的调试模式

当没有开始调试模式的时候,叶子看到的结果就是搜索不出来内容,当开启了调试模式后,就能看到具体的错误。所以,开启调试模式对跟踪错误是很有帮助的。

在wp-config.php的末尾,找到define(‘WP_DEBUG’, false)。将其修改为:

define('WP_DEBUG', true);

define('WP_DEBUG_LOG', true);

上面的语句的意思是开始调试模式,同时开启调试日志,调试日志生成在wp-content\debug.log。

开启调试模式后,叶子看到了具体的错误: [Got error ‘this version of PCRE is compiled without UTF support at offset 0’ from regexp]。

解决步骤

叶子看到了错误的原因是PCRE不支持UTF。PCRE(Perl Compatible Regular Expressions)是一个Perl库,包括 perl 兼容的正则表达式库。PCRE7.9以上已经不默认支持utf了,叶子用的是8.38,那么需要重新带上utf8的参数来安装PCRE。

下载PCRE 8.38的源码压缩包,下载地址:http://sourceforge.net/projects/pcre/files/pcre/。

切换目录

cd /usr/local/src/

使用wget下载压缩包

wget https://nchc.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.tar.gz

解压压缩包

tar zxvf pcre-8.38.tar.gz

切换到刚刚解压的目录中去

cd pcre-8.38

运行configure命令,带参数安装,并指定安装目录。注意,如果不指定prefix,则可执行文件默认放在/usr /local/bin,库文件默认放在/usr/local/lib,配置文件默认放在/usr/local/etc。其它的资源文件放在/usr /local/share。你要卸载这个程序,要么在原来的make目录下用一次make uninstall(前提是make文件指定过uninstall),要么去上述目录里面把相关的文件一个个手工删掉。

./configure --prefix=/opt/lampp --enable-utf8 --enable-unicode-properties

不指定prefix

./configure  --enable-utf8 --enable-unicode-properties

编译安装

make
make install

……
ln -sf pcre_refcount.3                   /opt/lampp/share/man/man3/pcre32_refcount.3
ln -sf pcre_study.3                      /opt/lampp/share/man/man3/pcre32_study.3
ln -sf pcre_utf32_to_host_byte_order.3   /opt/lampp/share/man/man3/pcre32_utf32_to_host_byte_order.3
ln -sf pcre_version.3                    /opt/lampp/share/man/man3/pcre32_version.3
make[3]: Leaving directory `/usr/local/src/pcre-8.38'
make[2]: Leaving directory `/usr/local/src/pcre-8.38'
make[1]: Leaving directory `/usr/local/src/pcre-8.38'

安装完成后,运行就不会出现PCRE不支持UTF的错误了。注意,请重启apache、mysql。

结束

你学会了吗?开启调试模式对找到错误很有效额。参考网址:http://stackoverflow.com/questions/35801425/xampp-mysql-this-version-of-pcre-is-compiled-without-utf-support-at-offset-0。


Warning: copy(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /opt/lampp/htdocs/wordpresssummer/wp-content/themes/summerleaf/inc/summer_setting.php on line 546

Warning: copy(): Failed to enable crypto in /opt/lampp/htdocs/wordpresssummer/wp-content/themes/summerleaf/inc/summer_setting.php on line 546

Warning: copy(https://www.wordpressleaf.com/wp-content/themes/summerleaf/images/tx/82.png): failed to open stream: operation failed in /opt/lampp/htdocs/wordpresssummer/wp-content/themes/summerleaf/inc/summer_setting.php on line 546

目前在“解决Mysql报错’this version of PCRE is compiled without UTF support at offset 0’(XAMPP)”上有一条评论


  1. Warning: copy(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /opt/lampp/htdocs/wordpresssummer/wp-content/themes/summerleaf/inc/summer_setting.php on line 546

    Warning: copy(): Failed to enable crypto in /opt/lampp/htdocs/wordpresssummer/wp-content/themes/summerleaf/inc/summer_setting.php on line 546

    Warning: copy(https://www.wordpressleaf.com/wp-content/themes/summerleaf/images/tx/78.png): failed to open stream: operation failed in /opt/lampp/htdocs/wordpresssummer/wp-content/themes/summerleaf/inc/summer_setting.php on line 546
    Zero说道:

    非常感谢,问题解决了,很有帮助!

发表评论

邮箱地址不会被公开。 必填项已用*标注