是的phpinfo不正确报告PCRE版本 [英] phpinfo is reporting incorrect pcre version

查看:283
本文介绍了是的phpinfo不正确报告PCRE版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了一天时间,试图找出一个奇怪的问题。我有一个运行到下面的错误一个Word preSS网站:

I've spent the day trying to figure out a strange problem. I have a WordPress site that is running into the following error:

Warning: preg_replace() [function.preg-replace]: Compilation failed: unknown option bit(s) set at offset -1 in /path/to/public_html/wp-includes/shortcodes.php on line 257

在该行WP-包括/短路codes.php如下:

That line in wp-includes/shortcodes.php is as follows:

$text = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text);

我发现这篇文章,似乎匹配得相当好与我的问题:<一href=\"http://labs.sasslantis.ee/2011/05/errors-in-word$p$pss-after-php-upgrade/\">http://labs.sasslantis.ee/2011/05/errors-in-word$p$pss-after-php-upgrade/

本文介绍的情况,其中有的不同输出的phpinfo(); 在Apache和上关于 libpcre

The article describes a situation in which there is different output of phpinfo(); in apache and on commandline with regard to libpcre

我证实,这是我通过创建)的测试文件的phpinfo(问题;它,也跑了从壳以下内容:

I verified that this is my issue by creating a test file with phpinfo(); in it and also ran the following from the shell:

php -r "phpinfo();"

脚本(Apache的?)版本返回 PCRE库版本6.6 06 - 2月 - 2006年
命令行版本返回 PCRE库版本=&GT; 8.21 2011-12-12

我在想该怎么办。我不是超级深谙命令行用法,所以我转向你都希望一些帮助。

I'm left wondering what to do. I'm not super well versed in command line usage, so I'm turning to you all hoping for some help.

文中提到阿帕奇固定启动的标志。我不知道这意味着什么。

The article mentions "fixing apache start-flags". I'm not sure what that means.

我还发现一个评论别处说:OK,原来这个问题是libpcre游逛在系统上,并错误地得到加载的旧版本有一次,我更新到libpcre的最新版本,问题固定的。我不完全知道如何审核服务器上的信息。

I've also found a comment somewhere else saying: "OK, it turned out that the problem was an older version of libpcre hanging around on the system and getting loaded by mistake. Once I updated to the latest version of libpcre, problem fixed." I'm not entirely sure how to vet this information on the server.

====编辑1 ====

==== Edit 1 ====

我已经有更多的信息:

/opt/pcre/bin/pcretest -C

返回

PCRE version 8.21 2011-12-12
Compiled with
UTF-8 support
Unicode properties support
No just-in-time compiler support
Newline sequence is LF
\R matches all Unicode newlines
Internal link size = 2
POSIX malloc threshold = 10
Default match limit = 10000000
Default recursion depth limit = 10000000
Match recursion uses stack

这并不完全令人惊讶,因为我们已经知道,在命令行中返回正确的版本。但对于一些疯狂的不明原因PHP,当通过网络运行,不返回正确的PCRE值。

This is not entirely surprising because we already know that the command line returns the correct version. But for some crazy unknown reason PHP, when run via the web, doesn't return the proper pcre values.

====编辑2 ====

==== Edit 2 ====

我被放倒这篇文章:<一href=\"http://www.bigboylemonade.com/pcre-version-problem-on-cpanel\">http://www.bigboylemonade.com/pcre-version-problem-on-cpanel

运行 pcretest -C 不完整的路径返回:

Running pcretest -C without the full path returns:

PCRE version 6.6 06-Feb-2006
Compiled with
  UTF-8 support
  Unicode properties support
  Newline character is LF
  Internal link size = 2
  POSIX malloc threshold = 10
  Default match limit = 10000000
  Default recursion depth limit = 10000000
  Match recursion uses stack

我要看看我能做些什么有关执行这些步骤,最后,不久将更新

I'm going to see what I can do about performing those last steps and will update shortly

推荐答案

好球员,我终于得到了笔记从我对他们是如何解决这个问题主持人:

Ok guys, I finally got the notes from my host about how they fixed the problem:

==================== Begin steps ==============================

当我开始这个特定的服务器上,这是可用的数据:

when I started on this particular server, this was the data available:

[root@host2] ~ >> pcretest -C PCRE
version 6.6 06-Feb-2006
Compiled with
UTF-8 support
Unicode properties support
Newline character is LF
Internal link size = 2
POSIX malloc threshold = 10
Default match limit = 10000000
Default recursion depth limit = 10000000
Match recursion uses stack

[root@host2] ~ >> /opt/pcre/bin/pcretest -C PCRE
version 8.21 2011-12-12
Compiled with
UTF-8 support Unicode properties support
No just-in-time compiler support
Newline sequence is LF
\R matches all Unicode newlines
Internal link size = 2
POSIX malloc threshold = 10
Default match limit = 10000000
Default recursion depth limit = 10000000
Match recursion uses stack

6.6版本也被显示出来任何的phpinfo()的网页,并在php -i。
    默认情况下在PHP版本> = 4.2,Apache的编译标志'--with-pcre的正则表达式
    是自动包括在内,所以任何EA运行将使用6.6。版本的cPanel
    提供。这里的关键是让操作系统了解PCRE库我们
    想Apache来使用,所以第一步是:

Version 6.6 was also showing up in any phpinfo() webpage and also in php -i. By default in php versions >= 4.2, the Apache compile flag '--with-pcre-regex' is automagically included, so any EA run will use the 6.6. version that cPanel provides. The key to this was letting the OS know about the pcre libraries we want Apache to use, so the first step was to:

[root@host2] etc >> echo "/opt/pcre/lib/" >> /etc/ld.so.conf

然后运行ldconfig的 - 现在我们有PCRE的两个版本的库
    可用于系统用户:

Then running ldconfig -- now we have the libraries for both versions of PCRE available for the system users:

[root@host2] etc >> ldconfig -v | grep -i pcre
/opt/pcre/lib:
libpcre.so.0 -> libpcre.so.0.0.1
libpcrecpp.so.0 -> libpcrecpp.so.0.0.0
libpcreposix.so.0 -> libpcreposix.so.0.0.0
libpcre.so.0 -> libpcre.so.0.0.1
libpcre.so.0 -> libpcre.so.0.0.1
libpcrecpp.so.0 -> libpcrecpp.so.0.0.0
libpcreposix.so.0 -> libpcreposix.so.0.0.0
libpcrecpp.so.0 -> libpcrecpp.so.0.0.0
libpcreposix.so.0 -> libpcreposix.so.0.0.0
[root@host2] etc >>

耶!现在,告诉Apache使用这些,而不是那些6.6,使用得心应手
    rawopts文件,并重建阿帕奇:

Yay! Now, to tell Apache to use those instead of the 6.6 ones, use the handy rawopts file and rebuild Apache:

[root@host2] etc >> echo "--with-pcre-regex=/opt/pcre" >>
/var/cpanel/easy/apache/rawopts/all_php5 [root@host2.brucesallan.com] etc >>
/scripts/easyapache --build

当它这样做,测试它:

[root@host2] etc >> php -i | grep -i "pcre library" PCRE
Library Version => 8.21 2011-12-12 [root@host2.brucesallan.com] etc >>

[root@host2] ~ >> pcretest -C PCRE
PCRE version 8.21 2011-12-12
Compiled with
UTF-8 support
Unicode properties support
Newline character is LF
Internal link size = 2
POSIX malloc threshold = 10
Default match limit = 10000000
Default recursion depth limit = 10000000
Match recursion uses stack

[root@host2] ~ >> /opt/pcre/bin/pcretest -C PCRE
PCRE version 8.21 2011-12-12
Compiled with
UTF-8 support
Unicode properties support
No just-in-time compiler support
Newline sequence is LF
\R matches all Unicode newlines
Internal link size = 2
POSIX malloc threshold = 10
Default match limit = 10000000
Default recursion depth limit = 10000000
Match recursion uses stack

========================== End ============================

这篇关于是的phpinfo不正确报告PCRE版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆