title: How to unserialize PHP sessions from Redis?
body: <p>How to unserialize PHP sessions stored in Redis? I need to fetch the session variables from a websocket server. Using <code>session_start()</code> is not possible</p>
  
  <pre><code>unserialize($this-&gt;redis-&gt;get('PHPREDIS_SESSION:'.$session_id));
  </code></pre>
  
  <p>Error</p>
  
  <blockquote>
    <p>unserialize(): Error at offset 0 of 319 bytes</p>
  </blockquote>
  
  <p>Redis</p>
  
  <p><code>apt-get install php7.0-redis</code></p>
  
  <pre><code>127.0.0.1:6379&gt; get PHPREDIS_SESSION:tmcls6v5n157q4kva4795hv4j1
  "time_user_offset|i:0;activity_time|i:1535643086;ltype|s:6:\"CLIENT\";cid|i:1;uid|i:1;uid_admin|i:1;is_suspended|i:0;is_timeout_time|i:0;is_trial|i:0;is_full|i:1;lid|i:197240;is_ready|i:1;currency_name|s:3:\"DKK\";set_reverse_sign|i:0;bid|i:1;block_name|s:14:\"text\";addon_crm|i:1;suid|i:0;is_supporter|i:0;tmp|i:0;"
  </code></pre>
  
  <p>php.ini</p>
  
  <pre><code>session.save_handler = redis
  session.save_path = "tcp://127.0.0.1:6379"
  </code></pre>
  
  <h1>update</h1>
  
  <p>sessions work fine in PHP so it is not a bug</p>