Traveling_Monk
Traveling_Monk

Reputation: 788

session_start fails with memcached handler

i am trying to use memcached to store sessions but it seems session_start fails when trying to use the handler i used this simple script to see what is happening

ini_set('error_reporting', E_ALL);
echo ini_get("session.save_handler").'<br>';
echo ini_get('session.save_path').'<br>';
echo(var_export(session_start(), true)).'<br>';
ini_set("session.save_handler",'files');
ini_set('session.save_path', '/tmp');
echo ini_get("session.save_handler").'<br>';
echo ini_get('session.save_path').'<br>';
echo(var_export(session_start(), true));

which outputs this

memcached
127.0.0.1:11211
false
files
/tmp
true

this is my configuration

memcache
memcache support    enabled
Active persistent connections   0
Version 2.2.7
Revision    $Revision: 327750 $
Directive   Local Value Master Value
memcache.allow_failover 1   1
memcache.chunk_size 8192    8192
memcache.default_port   11211   11211
memcache.default_timeout_ms 1000    1000
memcache.hash_function  crc32   crc32
memcache.hash_strategy  standard    standard
memcache.max_failover_attempts  20  20

these are my session settings

session
Session Support enabled
Registered save handlers    files user memcache sqlite
Registered serializer handlers  php php_binary wddx
Directive   Local Value Master Value
session.auto_start  Off Off
session.bug_compat_42   On  On
session.bug_compat_warn On  On
session.cache_expire    180 180
session.cache_limiter   nocache nocache
session.cookie_domain   xxxxxx.com  no value
session.cookie_httponly Off Off
session.cookie_lifetime 0   0
session.cookie_path /   /
session.cookie_secure   Off Off
session.entropy_file    no value    no value
session.entropy_length  0   0
session.gc_divisor  100 100
session.gc_maxlifetime  1440    1440
session.gc_probability  1   1
session.hash_bits_per_character 4   4
session.hash_function   0   0
session.name    CMSSESSID   PHPSESSID
session.referer_check   no value    no value
session.save_handler    memcached   memcached
session.save_path   127.0.0.1:11211 127.0.0.1:11211
session.serialize_handler   php php
session.use_cookies On  On
session.use_only_cookies    Off On
session.use_trans_sid   0   0

Upvotes: 0

Views: 4788

Answers (1)

jeffsama
jeffsama

Reputation: 1607

I follow this php-sessions-not-being-saved-in-memcache and able to find the direction to resolve my problem.

At first I only set the session.save_handler = memacache, then php errors popup said it failed to start.

Then I set the session.save_path = "tcp://127.0.0.1:11211?persistent=1&weight=1&timeout=1&retry_interval=15" and it works.

I am not sure if it is your problem too. Hope it helps.

Upvotes: 1

Related Questions