nicolasff/phpredis — Issue #134: Exception when set as session handler
Author: Dynom
Created: 2012-02-20 14:31:40+00:00
State: open

I get the following error, when using phpredis as session handler:

```
Fatal error: Uncaught exception 'RedisException' with message 'Connection closed' in /mnt/hgfs/../sesstest.php on line 3
RedisException: Connection closed in /mnt/hgfs/../sesstest.php on line 3
Call Stack:
0.0006 639184 1. {main}() /mnt/hgfs/../sesstest.php:0
0.0007 639232 2. session_start() /mnt/hgfs/../sesstest.php:3

Fatal error: Uncaught exception 'RedisException' with message 'Connection closed' in [no active file] on line 0
RedisException: Connection closed in /mnt/hgfs/../sesstest.php on line 3
Call Stack:
0.0006 639184 1. {main}() /mnt/hgfs/../sesstest.php:0
0.0007 639232 2. session_start() /mnt/hgfs/../sesstest.php:3
```

However, whenever I use the extension in userland, it works just fine:
```php
$r = new Redis();
$r->connect('localhost');
$r->incr('foo');
var_dump(
'Redis::get("foo") -> '. $r->get('foo'),
$r->info()
);
```
Result:
```
string(24) "Redis::get("foo") -> 503"
array(44) {
["redis_version"]=>
string(5) "2.4.7"
...
```

I'm currently on commit SHA: a5e53f1bbcd5d17902abf05de081a79cfee38185 of master.

Session related php.ini settings:
```
session.save_handler = redis
session.save_path = "tcp://localhost?weight=1"
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 0
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = Off
session.bug_compat_warn = Off
session.referer_check =
session.entropy_length = 0
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
[redis]
extension=/usr/lib/php5/20090626/redis.so
```