{"id":6733,"date":"2014-04-22T12:42:13","date_gmt":"2014-04-22T12:42:13","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/22\/problem-about-phpredis-collection-of-common-programming-errors\/"},"modified":"2014-04-22T12:42:13","modified_gmt":"2014-04-22T12:42:13","slug":"problem-about-phpredis-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/22\/problem-about-phpredis-collection-of-common-programming-errors\/","title":{"rendered":"problem about phpredis-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/4263a524ac9ab8d629a454cd61cae2c0?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nNarek<br \/>\nredis phpredis<br \/>\nUPDATE &#8211; SOLUTION FOR MENeed to install redis-server, in Ubuntu by command: sudo apt-get install redis-serverI installed phpredis, an can see in phpinfo():Redis Version 2.2.3After calling class constructor:$redis = new Redis(); $redis-&gt;connect(&#8216;127.0.0.1&#8217;, 6379, 2.5);everything is ok.print_r($redis);returns Redis Object ( [socket] =&gt; Resource id #21 ). But when I want to call any other method, for example:$redis-&gt;info();I got error:Fatal error: Uncaught exception &#8216;RedisException&#8217; with<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f4a091d03eb138e977a4fabad7ec1c7e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nStephen Sarcsam Kamenar<br \/>\nphp redis phpredis<br \/>\n&#8220;PHP Fatal error: Uncaught exception &#8216;RedisException&#8217; with message &#8216;read error on connection'&#8221;The driver here is phpredis$redis-&gt;blpop(&#8216;a&#8217;, 0);This always times out after ~1 minute. My redis.conf says timeout 0 and $redis-&gt;getOption(Redis::OPT_READ_TIMEOUT) returns double(0)If I do this it has never timed out $redis-&gt;setOption(Redis::OPT_READ_TIMEOUT, -1);Why do I need -1? Redis documentation says timeout 0 in redis.conf should never time me out.&#8221;By default recent versions of Redis don<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Narek redis phpredis UPDATE &#8211; SOLUTION FOR MENeed to install redis-server, in Ubuntu by command: sudo apt-get install redis-serverI installed phpredis, an can see in phpinfo():Redis Version 2.2.3After calling class constructor:$redis = new Redis(); $redis-&gt;connect(&#8216;127.0.0.1&#8217;, 6379, 2.5);everything is ok.print_r($redis);returns Redis Object ( [socket] =&gt; Resource id #21 ). But when I want to call any [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6733","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6733"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6733\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}