Reputation: 357
I just uploaded my site that is linked with a MySQL database (Its my first time)
When I open the page that pulls info from the database it always comes up with this error (it goes away when I refresh)
Warning: mysql_pconnect() [function.mysql-pconnect]: MySQL server has gone away in D:\Hosting\2941136\html\test_sites\solera2013\Connections\SoleraMenuSystem.php on line 9
Can anyone tell me why this error pops up the first time the page loads and goes away after refresh
Thanks Dan
Here is the site: http://graves-incorporated.com/test_sites/solera2013/menu_dinner.php
Upvotes: 1
Views: 82
Reputation: 11071
Read MySQL reference for this error message:
https://dev.mysql.com/doc/refman/5.0/en/gone-away.html
Upvotes: 2
Reputation: 64476
You should increase mysql.connect_timeout option
ini_set('mysql.connect_timeout', 500);
ini_set('default_socket_timeout', 500);
you can also ping your connection that it is alive or lost
if(!mysql_ping($connection)){
// reconnect
}
Upvotes: 0