My scripts are getting quite riddled with forked processes in a lot of different functions. Whenever pcntl_fork()
is called, all MySQL connections are lost. If I run a query on a PDO MySQL connection I get the error "MySQL server has gone away"
.
The problem is that this error only shows up in PDO::errorinfo()
after a failed query execution. I would like to be able to detect if the MySQL server "has gone away" before I try to run a query. That way I could create a PDO wrapper that makes a new connection for me in such situations.
Any ideas?