{"issue":{"state":"closed","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"milestone":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/24a46a2b8372672fbe8306a8a7505a0c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"24a46a2b8372672fbe8306a8a7505a0c","url":"https://api.github.com/users/Horzerus","login":"Horzerus","id":1092479},"assignee":null,"updated_at":"2011-11-16T12:05:59Z","labels":[],"closed_at":"2011-11-16T12:05:59Z","comments":3,"url":"https://api.github.com/repos/nicolasff/phpredis/issues/82","body":"I want client-script to save data in DB and then invoke (call) to publish() function. And server script should use these data from DB to process the incoming message.\r\nBut inside the callback function does not work use the command to access another DB connection.\r\n\r\nserver.php file:\r\n\r\n```php\r\n<?php\r\nfunction callback($redis1, $channel, $msg) {\r\n    global $redis2;\r\n\r\n    echo \"message: '{$msg}'\\n\";\r\n\r\n    echo \"foo: \";\r\n    var_dump($redis2->hGet(\"h1\", \"foo\")); // Always returns false :(\r\n}\r\n\r\n$redis1 = new Redis();\r\n$redis1->pconnect('127.0.0.1', 6379);\r\n\r\n$redis2 = new Redis();\r\n$redis2->pconnect('127.0.0.1', 6379);\r\n\r\n$redis1->subscribe(array('c1'), 'callback');\r\n```\r\n\r\nclient.php file:\r\n\r\n```php\r\n<?php\r\n$redis = new Redis();\r\n$redis->connect('127.0.0.1', 6379);\r\n\r\n$redis->hSet(\"h1\", \"foo\", rand());\r\n$redis->publish(\"c1\", \"hi!\");\r\n```\r\n\r\nI run in the first terminal: \r\n\r\n```bash\r\n$ php server.php\r\n```\r\n\r\nThen, I run in the second terminal: \r\n\r\n```bash\r\n$ php client.php\r\n$ php client.php\r\n```\r\n\r\nAs a result, in the first terminal:\r\n\r\n```sh\r\nmessage: 'hi!'\r\nfoo: bool(false)\r\n\r\nmessage: 'hi!'\r\nfoo: bool(false)\r\n```","html_url":"https://github.com/nicolasff/phpredis/issues/82","title":"Inside the subscribe-callback function does not work access to DB by another connection","number":82,"id":2254503,"created_at":"2011-11-16T10:01:34Z"},"action":"closed"}