title: How get all keys in redis using php redis?
body: <p>I am using <a href="https://github.com/nicolasff/phpredis" rel="nofollow noreferrer">https://github.com/nicolasff/phpredis</a>  extension to access redis. I want to get all keys in redis from PHP code.
  I tried following code:</p>
  <pre><code>$redis = new Redis();
  $redis-&gt;connect('127.0.0.1', 6379);
  $allKeys = $redis-&gt;keys('*');
  print_r($allKeys); // nothing here
  </code></pre>
  <p>But following command in shell giving results:</p>
  <pre><code>127.0.0.1:6379&gt; KEYS *
  &quot;kq92p7b5tf63tmk12v54373e03 hs7ep4lc2m6ci5kk5dosgpelg4 
  pt7lfejenqbmmovjpmp9aojuf0 2p05gf20or6r5ee5i7sts90kn1 
  cb1d6g3d3bvqetjfmkmaurmpp3&quot;
  </code></pre>
  <p>I am able to set key and data in following manner from PHP script:</p>
  <pre><code>$redis = new Redis();
  $redis-&gt;connect('127.0.0.1', 6379);
  $redis-&gt;set(session_id(), json_encode(array('uname'=&gt;'messi fan')));
  </code></pre>
  <p>How to get <code>KEYS *</code> from redis using phpredis ?</p>