I am running my php script and getting an intermittent issue:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2013 Lost connection to MySQL server during query'
Is it possible to ping mysql in PDO if such error occurs?
I just want to bring this in your notice that my PDO connection is not persistent. I am connecting PDO in loop. I suppose every time a new connection will open up in loop. If this is so, then why mysql is losing connection? Or it may possible that if a PDO connection already exists then it gives the existing pdo object. but if such error occurs, it should try to reconnect and give the new connection instead of error.
Any possible solution to avoid the error?