Iva*_*vak 9 php apache command-line pcre
我花了一天时间试图找出一个奇怪的问题.我有一个WordPress网站遇到以下错误:
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
Run Code Online (Sandbox Code Playgroud)
wp-includes/shortcodes.php中的那一行如下:
$text = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text);
Run Code Online (Sandbox Code Playgroud)
我发现这篇文章似乎与我的问题相符:http://labs.sasslantis.ee/2011/05/errors-in-wordpress-after-php-upgrade/
本文描述了一种情况,其中phpinfo();
在apache和命令行上有不同的输出libpcre
我通过在其中创建测试文件phpinfo();
并从shell运行以下内容来验证这是我的问题:
php -r "phpinfo();"
Run Code Online (Sandbox Code Playgroud)
脚本(apache?)版本返回PCRE Library Version 6.6 06-Feb-2006
命令行版本返回PCRE Library Version => 8.21 2011-12-12
我想知道该怎么做.我不是非常精通命令行使用,所以我转向你们都希望得到一些帮助.
文章提到"修复apache start-flags".我不确定这意味着什么.
我还在其他地方发现了一条评论说:"好吧,事实证明问题是libpcre的旧版本在系统上闲逛并且错误地加载.一旦我更新到最新版本的libpcre,问题就解决了. " 我不完全确定如何在服务器上审查这些信息.
====编辑1 ====
我有更多信息:
/opt/pcre/bin/pcretest -C
Run Code Online (Sandbox Code Playgroud)
返回
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
Run Code Online (Sandbox Code Playgroud)
这并不奇怪,因为我们已经知道命令行返回正确的版本.但是由于一些疯狂的未知原因PHP,当通过网络运行时,不会返回正确的pcre值.
====编辑2 ====
我写了这篇文章:http://www.bigboylemonade.com/pcre-version-problem-on-cpanel
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
Run Code Online (Sandbox Code Playgroud)
我将会看到我可以做些什么来执行这些最后的步骤,并将很快更新
Iva*_*vak 10
好的,我终于得到了主持人关于他们如何解决问题的说明:
==================== Begin steps ==============================
Run Code Online (Sandbox Code Playgroud)
当我开始使用这个特定的服务器时,这是可用的数据:
[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
Run Code Online (Sandbox Code Playgroud)
版本6.6也出现在任何phpinfo()网页和php -i中.默认情况下,php版本> = 4.2,自动包含Apache编译标志'--with-pcre-regex',因此任何EA运行都将使用6.6.cPanel提供的版本.关键是要让操作系统了解我们希望Apache使用的pcre库,所以第一步是:
[root@host2] etc >> echo "/opt/pcre/lib/" >> /etc/ld.so.conf
Run Code Online (Sandbox Code Playgroud)
然后运行ldconfig - 现在我们为系统用户提供了两个版本的PCRE的库:
[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 >>
Run Code Online (Sandbox Code Playgroud)
好极了!现在,要告诉Apache使用那些而不是6.6,使用方便的rawopts文件并重建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
Run Code Online (Sandbox Code Playgroud)
完成后,测试一下:
[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 ============================
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
9870 次 |
最近记录: |