SMF Support > SMF 2.0.x Support
MYSQL server has gone away!!!
(1/1)
Wombat.AU:
My old forum (mit v2.0.2) suddenly stopped and simply displayed "MYSQL server has gone away". WT? and where!
I finally discovered in the error log the following...
"PHP Warning: mysql_real_escape_string() expects parameter 2 to be resource, boolean given in /home/blah/blah/blah/smf/Sources/Subs-Db-mysql.php on line 132".
By adding the "@" char to the function call on that line...
"return sprintf('\'%1$s\'', @mysql_real_escape_string($replacement, $connection));"
...the forum fired up again, allowed access to admin and etc blah blah. I don't have time to try to sort out properly but there are other uses of the same function however so far without the same hassle.
And FYI my host recently migrated my sites server (Nix) to a LiteSpeed server (and updated package) with...
MySQL version: 5.1.63-cll
&
PHP version: 5.3.14
...installed. So perhaps somebod suffers the same weird problem and is helped.
Regards.
MrPhil:
Just some notes: I think the resource/boolean error is a consequence of the database failure, not the cause. Can you go into phpMyAdmin and confirm that MySQL server is now up and running? Maybe it was down for a short time. Does your code now work when you remove the @ you added? It's generally risky to suppress error messages by using @ -- the messages are there to tell you something went terribly wrong. It's like removing the battery from your smoke detector because it just went off in the middle of the night.
I'm not familiar with LiteSpeed, other than it is supposed to be a faster replacement for the Apache server. It's possible that it has some incompatibility with your PHP and/or MySQL processors (but then I would expect every other user on the server to be screaming).
Navigation
[0] Message Index
Go to full version