phpinfo is reporting incorrect pcre version

前端 未结 2 678
抹茶落季
抹茶落季 2020-12-30 10:41

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() [funct         


        
2条回答
  •  抹茶落季
    2020-12-30 11:32

    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
    

    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
    

    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 >>
    

    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
    

    When it's done, test it:

    [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 ============================
    

提交回复
热议问题