Commit 723f0f19 authored by Jean Baptiste Favre's avatar Jean Baptiste Favre

PHP 5.4: Fix 'mysql has gone away' error when using mysqli driver with forked...

PHP 5.4: Fix 'mysql has gone away' error when using mysqli driver with forked daemons (at least TwitterBridge)
parent f1a3d5a3
......@@ -48,6 +48,17 @@ class Daemon
function background()
{
/* Starting PHP 5.4 (dotdeb), maybe earlier for some version/distrib
* seems MySQL connection using mysqli driver get lost when fork.
* Need to unset it so that child process recreate it.
*
* Not needed if using mysql driver (but it's deprecated starting PHP 5.5)
*
* @todo FIXME cleaner way to do it ?
*/
global $_DB_DATAOBJECT;
unset($_DB_DATAOBJECT['CONNECTIONS']);
$pid = pcntl_fork();
if ($pid < 0) { // error
common_log(LOG_ERR, "Could not fork.");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment