Last active
August 29, 2015 14:17
-
-
Save lexaurin/8897f1be48b9e8747b7d to your computer and use it in GitHub Desktop.
phpredis "errno=32 Broken pipe" bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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