hi guys
i use mysql pdo for connect to database
but Sometimes i see this error: General error: 2006 MySQL server has gone away
why?
thank you
5 replies to this topic
#1
Posted 17 December 2011 - 07:24 AM
|
|
|
#2
Posted 18 December 2011 - 01:29 AM
Hello,
Are you running the database on a shared server, localhost, or on your own dedicated server? If it is a shared server, it may very well point to a misconfiguration and it would make sense to contact the support area if your code is not at fault.
Are you running the database on a shared server, localhost, or on your own dedicated server? If it is a shared server, it may very well point to a misconfiguration and it would make sense to contact the support area if your code is not at fault.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#3
Posted 18 December 2011 - 03:16 AM
Hello,
Thank you for reply
ye in the share server and my web site is very slow, but with mysql function is normally speed for view page
please give me more information, i have access to change php.ini
---------- Post added at 11:16 AM ---------- Previous post was at 09:58 AM ----------
My support center is said:
You would need to check with your developer or probably optimize your site code in this case.
However there is nothing in addition that we can do if there is problem with the resolution because all servers have same standard where the hosting package is located.
___________________________
this is my connection code:
Thank you for reply
ye in the share server and my web site is very slow, but with mysql function is normally speed for view page
please give me more information, i have access to change php.ini
---------- Post added at 11:16 AM ---------- Previous post was at 09:58 AM ----------
My support center is said:
You would need to check with your developer or probably optimize your site code in this case.
However there is nothing in addition that we can do if there is problem with the resolution because all servers have same standard where the hosting package is located.
___________________________
this is my connection code:
public function sqlConnection()
{
try
{
self::$dbConnect = new PDO("mysql:host=" . self::$dbHost . ";port=" . self::$dbPort . ";dbname=" . self::$dbName,
self::$dbUsername,
self::$dbPassword, array(
PDO::ATTR_PERSISTENT => false,
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"
));
self::$dbConnect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e)
{
throw new databaseException($e->getMessage(), 102);
}
}
#4
Posted 18 December 2011 - 02:17 PM
I can see nothing in that specific code block that would hang the server. It is a small request too at that.
Where is the MySQL server hosted? Where is $dbHost, hosted on the exact same server or elsewhere? If your host is making you connect to an external server then it may be too slow to connect to, and there is not much you can optimise. It may also point to an issue with PDO, as it is a binary driver within PHP usually however that may be pushing it.
Where is the MySQL server hosted? Where is $dbHost, hosted on the exact same server or elsewhere? If your host is making you connect to an external server then it may be too slow to connect to, and there is not much you can optimise. It may also point to an issue with PDO, as it is a binary driver within PHP usually however that may be pushing it.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#5
Posted 19 December 2011 - 12:09 AM
host in internal server
and i use localhost
help more for this problem
and i use localhost
help more for this problem
#6
Posted 19 December 2011 - 12:46 AM
lol33d said:
host in internal server
and i use localhost
help more for this problem
and i use localhost
help more for this problem
Does this issue occur when you use standard MySQL code to connect to the database? Unless you are using code that you have not shown us that may be breaking the connection with the MySQL host it is entirely possible the host is at fault.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









