Support » Fixing WordPress » WordPress database error

  • I just brought home a new computer which I installed redhat on. I’ve never had problems with wordpress until I installed it on this new box and moved everything over.

    1) wordpress isn’t find my plugins directory… but that’s not a big deal since it’s not visible to users

    2) where the page links shound be at the bottom of my front page…i get a sql error:

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ” at line 1]

    (you can see this on

    I checked the apache logs and I have thousands of lines reporting the same pcre_fullinfo() error on several files:

    PHP Warning: preg_match: internal pcre_fullinfo() error -3 in /usr/local/apache2/htdocs/blog/wp-includes/vars.php on line 31

    PHP Warning: preg_match: internal pcre_fullinfo() error -3 in /usr/local/apache2/htdocs/blog/wp-includes/wp-db.php on line 154

    I downloaded the latest Zend, Apache, php and installed them all like I always did in the past. I copied my database from the old server and uploaded my theme that I had been using.

    I’ve been pulling my hair out…why am I getting this error where the page links should be???


Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Peter Westwood


    WordPress Lead Developer

    This looks like you may have a mismatch between the versions of php/mysql/apache installed.

    Can you confirm which versions you have installed and maybe setup a phpinfo page to confirm that all the modules have loaded ok?


    Apache: 2.0.54
    PHP: 5.0.4
    MySQL: 14.7 Distrib 4.1.12

    Is there a list somewhere of what is compatible? I figurd the newest would be the best route.


    Moderator Peter Westwood


    WordPress Lead Developer

    Ok those look good.

    Reading the error message again makes me think that something is generating dodgy SQL queries what do you have in you themes index.php underneath the POST loop where that error message is appearing?

    Could you post the source of your themes index.php somewhere to examine?

    There it is… I don’t want to think it’s the theme…i’ve been using it for a long time and never had a problem before…

    *pulls more hair out*

    and here is the offending code (i think) from wp-includes/template-functions-links.php

    function posts_nav_link($sep=' — ', $prelabel='« Previous Page', $nxtlabel='Next Page »') {
    global $request, $posts_per_page, $wpdb, $max_num_pages;
    if (! is_single()) {

    if (get_query_var('what_to_show') == 'posts') {
    if ( ! isset($max_num_pages) ) {
    preg_match('#FROM (.*) GROUP BY#', $request, $matches);
    $fromwhere = $matches[1];
    $numposts = $wpdb->get_var("SELECT COUNT(ID) FROM $fromwhere");
    $max_num_pages = ceil($numposts / $posts_per_page);
    } else {
    $max_num_pages = 999999;

    if ($max_num_pages > 1) {
    echo preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $sep);
    next_posts_link($nxtlabel, $max_page);

    Moderator Peter Westwood


    WordPress Lead Developer


    Wading through the following php bug reports it looks like the version of PHP you have is built in such a way that the PCRE stuff won’t work – you should try a different PHP version and see if that fixes the issue – try 4.4.0 for example instead.

    php Bugs:

    hope this helps



    great research, i will definately try that. at least now i know i’m not alone or crazy 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘WordPress database error’ is closed to new replies.