WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] lost connection to mySQL server during query (18 posts)

  1. taupo
    Member
    Posted 8 years ago #

    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

  2. vkaryl
    Member
    Posted 8 years ago #

    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.

  3. taupo
    Member
    Posted 8 years ago #

    thanks will start searching

  4. estjohn
    Member
    Posted 8 years ago #

    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.

  5. taupo
    Member
    Posted 8 years ago #

    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

  6. estjohn
    Member
    Posted 8 years ago #

    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?

  7. taupo
    Member
    Posted 8 years ago #

    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

  8. vkaryl
    Member
    Posted 8 years ago #

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

  9. harikumar
    Member
    Posted 8 years ago #

    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?

  10. gwittenborn
    Member
    Posted 8 years ago #

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

    -Grant

  11. Brian-r
    Member
    Posted 8 years ago #

    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.

  12. Brian-r
    Member
    Posted 8 years ago #

    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.

  13. Brian-r
    Member
    Posted 8 years ago #

    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.

  14. Brian-r
    Member
    Posted 8 years ago #

    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.

  15. pauljohns
    Member
    Posted 8 years ago #

    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.

  16. OCSupertones
    Member
    Posted 8 years ago #

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

  17. flashstef
    Member
    Posted 8 years ago #

    I get this error:

    Warning: Cannot modify header information - headers already sent by (output started at ./wordpress/wp-includes/wp-db.php:102) in ./wordpress/wp-admin/post.php on line 128

    I have the same issues, but the harikumar's fix didn't resolve anything. I am hunting for whitespaces now in all the files... The strange thing is that I have another website, hosted at the same Hosting Service, and with the exact same configurations. On that site it works fine, on the other it doesn't...

  18. MichaelER
    Member
    Posted 7 years ago #

    This is the solution I found for this problem.

    Sign in to your wp-admin. Go to Options > Writing > Update Services. Delete ALL update services except:

    http://rpc.pingomatic.com/

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags