Errors in wordpress after php upgrade

Got an interesting problem few days ago. Just updated php (and apache and some other programs) and did “/etc/init.d/apache2 graceful” when suddenly got errors in wordpress blogs like this

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

Code-repo showed that there were no changes for long time in shortcodes.php file, so there was like two possibilities – some new problem with php or some weird error in my server.

Got also two links from wordpress bugtracker
http://wordpress.org/support/topic/warning-preg_match-functionpreg-match-errors
http://wordpress.org/support/topic/plugin-contact-form-7-problem-with-preg

from where I found out, that it might be releated to libpcre. I created test.php with phpinfo(); inside and found out that php was using pcre 7.9 when in system was actually installed 8.12.

final step to discovery of problem was some page where some user complained, that he has different output of phpinfo(); in apache and on commandline. So, inspired of that, I checked out and got interesting result:

$ php --info|grep -i pcre
/.../
PCRE Library Version => 8.12 2011-01-15
/.../

also were both files pointing to right place

$ ldd /usr/bin/php | grep pcre
        libpcre.so.0 => /lib/libpcre.so.0 (0xb7230000)

and

$ ldd /usr/lib/php5.3/apache2/libphp5.so | grep -i pcre
        libpcre.so.0 => /lib/libpcre.so.0 (0xb6aba000)

So, only possible explanation could be, that apache graceful restart was not enough. When I did restart, it complained about configuration (yeah, two changes in same time, bad-bad!) – ssl port was already taken), and when I fixxed apache start-flags it started and also showed php right pcre version and problem in wordpress dissapeared.

This entry was posted in Uncategorized. Bookmark the permalink.

6 Responses to Errors in wordpress after php upgrade

  1. Ivan Novak says:

    Would you be kind enough to be a bit more specific with what you did with apache’s start-flags that fixed the issue? I know it’s been a while since you published this but I’m stuck with what seems to be the same issue and I’d love some insight. Thanks in advance.

    • Urmas says:

      I can’t remember exactly what was wrong with apache – probably I was made some mistake in virtual-hosts configuration, but thats not important if you make normal stop-start after recompiling php (this mistake made apache to not restart GRACEFULLY, but at the moment I fiixed apache conf and did full stop and start new php module was loaded).

      To give some more help, please send some more information – distribution you use, and output of commands abowe, I used.

      • Ivan Novak says:

        Thanks for your reply!

        php 5.3.10
        dso

        $ php --info|grep -i pcre
        /.../
        PCRE Library Version => 8.21 2011-12-12
        /.../

        $ php -r "phpinfo();"
        /.../
        PCRE Library Version => 8.21 2011-12-12
        /.../

        $ ldd /usr/bin/php5 | grep pcre
        libpcre.so.0 => /opt/pcre/lib/libpcre.so.0 (0x00002ac23f1a7000)

        $ldd /usr/bin/php | grep pcre
        libpcre.so.0 => /opt/pcre/lib/libpcre.so.0 (0x00002b1e6c304000)

        Then phpinfo() run via the web returns
        /…/
        PCRE Library Version 6.6 06-Feb-2006
        /…/

        • Urmas says:

          * what about ldd libphp5.so file?
          ** confirm, that in apache config is pointed to right so file (for example in /etc/apache2/modules.d/70_mod_php5.conf : LoadModule php5_module modules/libphp5.so –> file must exist /usr/lib/apache2/modules/libphp5.so which is symlink to /usr/lib/php5.3/apache2/libphp5.so)
          * check so file date and time (is those at time, when you recompiled?)
          * did you restart apache after recompiling php?

  2. Phil Taylor says:

    I had this issue exactly – I changed from dso to suPHP in the php conf builder in cPanel and then the problem went away, and the pcre was reported at the same versions all over – after 4 hours debugging 🙁

    • Urmas says:

      [Sorry, that it took so long time to confirm your comment]

      fixxing by changing to suPHP seems to me same problem – apache still has old php module – is this module not recompiled after upgrading other packages or is apache not restarted.

Leave a Reply

Your email address will not be published. Required fields are marked *

Exaptcha (all lowercase letters) reload *