Support » Installing WordPress » lost connection to mySQL server during query

  • Resolved taupo

    (@taupo)


    following is the error message I am getting when publishing. see http://www.taupo.org.nz/wordpress for the then result. I have posted on this issue a couple of times and suggestion is that it is a host problem. My host has no answers???

    Could having a database name and username the same conflict????

    error message……….. WordPress database error: [MySQL server has gone away]
    SELECT ID, user_login, user_pass FROM wp_users WHERE user_login = ‘admin’

    Warning: Cannot modify header information – headers already sent by (output started at /home/sites/site182/web/wordpress/wp-includes/wp-db.php:98) in /home/sites/site182/web/wordpress/wp-includes/pluggable-functions.php on line 109

    Warning: Cannot modify header information – headers already sent by (output started at /home/sites/site182/web/wordpress/wp-includes/wp-db.php:98) in /home/sites/site182/web/wordpress/wp-includes/pluggable-functions.php on line 110

    Warning: Cannot modify header information – headers already sent by (output started at /home/sites/site182/web/wordpress/wp-includes/wp-db.php:98) in /home/sites/site182/web/wordpress/wp-includes/pluggable-functions.php on line 111

    Warning: Cannot modify header information – headers already sent by (output started at /home/sites/site182/web/wordpress/wp-includes/wp-db.php:98) in /home/sites/site182/web/wordpress/wp-includes/pluggable-functions.php on line 112

    Warning: Cannot modify header information – headers already sent by (output started at /home/sites/site182/web/wordpress/wp-includes/wp-db.php:98) in /home/sites/site182/web/wordpress/wp-includes/pluggable-functions.php on line 114

    This is the PHP script that the above relates to (I have added line numbers)

    endif;

    if ( !function_exists(‘auth_redirect’) ) :
    function auth_redirect() {
    // Checks if a user is logged in, if not redirects them to the login page
    if ( (!empty($_COOKIE[‘wordpressuser_’ . COOKIEHASH]) &&
    !wp_login($_COOKIE[‘wordpressuser_’ . COOKIEHASH], $_COOKIE[‘wordpresspass_’ . COOKIEHASH], true)) ||
    (empty($_COOKIE[‘wordpressuser_’ . COOKIEHASH])) ) {
    header(‘Expires: Wed, 11 Jan 1984 05:00:00 GMT’); =line 109
    header(‘Last-Modified: ‘ . gmdate(‘D, d M Y H:i:s’) . ‘ GMT’); =line 110
    header(‘Cache-Control: no-cache, must-revalidate, max-age=0’); =line 111
    header(‘Pragma: no-cache’); =line 112

    header(‘Location: ‘ . get_settings(‘siteurl’) . ‘/wp-login.php?redirect_to=’ . urlencode($_SERVER[‘REQUEST_URI’])); =line 114
    exit();
    }
    }

    Can anyone help????? Please!!!! even just some suggested questions I can put to my host

Viewing 15 replies - 1 through 15 (of 17 total)
  • Don’t think it’s a db/user same name conflict, I use that all the time (not same host of course….)

    You might try searching here on “headers already sent” – there’s a ton of info about that error.

    thanks will start searching

    I have had the lost connection from databas… waited about 5 minutes and it was ok again

    For the header output.. you have something from a plugin that has already sent it out once (sometimes it happens when you copy a pap page from a page on the web and there is an extra space after the last ?> in the paste job on the plugin.php that you creadted.

    I’m going through files now looking for white space. I have just re-installed wordpress for 4th time and deleted database on server and reinstalled. I have not added any pugins? and checked default plugins for white space – none

    Im not sure then.. do you have cookies enabled on your browser.. are you runing any firewall programs – norton internet security gave me a LOT of problems at one time..had to disable it to goto websites and cookie probs.. do you use anything like that? in browser, privacy and security settings all at default?

    Its Fixed! thanks for all you guys help!!!! it was dreaded white space in wp-blogheader.php.

    I had considered Norton and firewalls and had deleted the whole lot. not the problem this timer

    Hey thanks again

    Yup. That selection of errors is almost always white space somewhere. Glad it’s sorted.

    harikumar

    (@harikumar)

    In case anyone else runs into this same issue, the problem is the following line in wp-blog-header.php (line 3):

    if (! isset($wp_did_header)):

    The bug is the whitespace between “!” and “isset”. Remove that space so the line reads like this:

    if (!isset($wp_did_header)):

    and all is well 🙂

    How does one go about reporting this to the wordpress development team for the next release?

    Good catch! Just ran into this same problem last night. Quickly fixed thanks to this thread. Thanks, harikumar.

    -Grant

    Awesome!

    I had a space in my file, too. Fresh (new) install of WordPress that is two days old.

    Made the change (deleted the space), we’ll see how it goes. Thank you.

    If anybody sees this..

    Where can I find a correct source for wp-blog-header.php?

    Using search on this site finds many versions, almost all much longer than the one I have with my 2.0.2 install. And they all have the original spacing from harikumar’s post (above), instead of the corrected one.

    At http://trac.wordpress.org/wiki for example the header file is much longer than the mine, and I’m wondering if the missing statements are affecting the import from Blogger.

    BTW, I’m almost completed six months of posts imported.

    I’m a bit sheepish, I was looking at an older version of the source file.

    This seems to be the latest one:

    http://trac.wordpress.org/file/trunk/wp-blog-header.php?rev=2633

    I’ve modified mine accordingly and trying another update. Again, the spacing of the line:

    if (! isset($wp_did_header)):

    Is in question.

    A followup, I traded a few e-mails with Andy (the person who wrote the import script) and he said

    The whitespace issue you mentioned it really not an issue. PHP ignores whitespace there.

    harikumar – Thanks for figuring that out!
    I love it when someone offers an actual fix instead of suggesting plugins that alter the way pinging and headers are handled, which kinda just covers up the problem, instead of actually solving. You rock!

    Brian-r – That’s really wierd, because after I took out the white space and tested allowing and disallowing comments a few times, I didn’t run into that mySQL error anymore.

    Thanks for the post guys! I’ll try it and make sure it works for me too!

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘lost connection to mySQL server during query’ is closed to new replies.