Skip to content

Instantly share code, notes, and snippets.

@lexaurin
Last active August 29, 2015 14:17
Show Gist options
  • Save lexaurin/8897f1be48b9e8747b7d to your computer and use it in GitHub Desktop.
Save lexaurin/8897f1be48b9e8747b7d to your computer and use it in GitHub Desktop.
phpredis "errno=32 Broken pipe" bug
<?php
$redis = new Redis();
var_dump($redis->connect('127.0.0.1'));
echo 'Parent pid: ' . getmypid() . PHP_EOL;
set_error_handler(function($errno, $errstr, $errfile, $errline) {
echo 'Error in PID ' . getmypid() . ': ' . $errstr . PHP_EOL;
});
for ($i = 0; $i < 5; $i++) {
$pid = pcntl_fork();
if ($pid == 0) { //child
echo 'Child pid: ' . getmypid() . PHP_EOL;
sleep(2);
break;
} else {
pcntl_wait($status);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment