问题
Warning: mysql_pconnect(): MySQL server has gone away in D:\xampp-portable\htdocs\project\database\dbconn.php on line 16
I got this error on the top of the page, but the page shows correctly. How can i solve this problem or just avoid showing the warning on the page? I am using Cleardb created from Windows Azure trial.
line 16: $conn = mysql_pconnect($hostname_conn, $username_conn, $password_conn,TRUE) or trigger_error(mysql_error(),E_USER_ERROR);
回答1:
You'll get this error any time you get back a persistent connection that has since timed out.
Is there a specific reason why you are using mysql_pconnect
instead of mysql_connect
? If not, try using mysql_connect
instead.
If this is new code, you shouldn't be using the mysql_*
functions at all as they are inherently unsafe and will soon be deprecated. Use PDO instead if possible.
来源:https://stackoverflow.com/questions/14060235/warning-mysql-pconnect-mysql-server-has-gone-away-with-using-cloud-database