Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

session_write_close() issues again #310

Closed
helver opened this Issue Mar 4, 2013 · 1 comment

Comments

Projects
None yet
2 participants

helver commented Mar 4, 2013

I apologize in advance if this issue has already been resolved. I've done some digging through old issues and I see where this was apparently addressed in phpredis-2.2.2, but I'm still getting it.

So here's the symptom:

itworks
Warning: session_write_close(): Failed to write session data (redis). Please verify that the current setting of session.save_path is correct (localhost) in /home/swapdev/htdocs/handle_register.php on line 48

The relevant section of my code is:

$values = array(
"id" => uuid_create(UUID_TYPE_DEFAULT),
"username" => "blah",
);

$redis = new Redis();
$redis->connect('localhost', 6379);
$test = $redis->set('testvar', 'itworks');
$test = $redis->get('testvar');
echo (print_r($test,1));

ini_set('session.save_handler', 'redis');
ini_set('session.cookie_domain', '.localhost.localhost');
#ini_set('session.save_path', 'tcp://127.0.0.1:6379?weight=1');
#ini_set('session.save_path', 'tcp://127.0.0.1:6379');
#ini_set('session.save_path', 'tcp://127.0.0.1');
#ini_set('session.save_path', 'tcp://localhost:6379?weight=1');
#ini_set('session.save_path', 'tcp://localhost:6379');
#ini_set('session.save_path', 'tcp://localhost');
#ini_set('session.save_path', '127.0.0.1:6379?weight=1');
#ini_set('session.save_path', '127.0.0.1:6379');
#ini_set('session.save_path', '127.0.0.1');
#ini_set('session.save_path', 'localhost:6379?weight=1');
#ini_set('session.save_path', 'localhost:6379');
ini_set('session.save_path', 'localhost');
session_set_cookie_params(0, '/', '.localhost.localhost');
session_name('localhostest');
session_start();

$_SESSION["id"] = $values["id"];
$_SESSION["username"] = $values["username"];
session_write_close();

Relevant portion of my php.ini file:

[Session]
; Handler used to store/retrieve data.
; http://php.net/session.save-handler
; session.save_handler = files
session.save_handler = redis
; where MODE is the octal representation of the mode. Note that this
; does not overwrite the process's umask.
; http://php.net/session.save-path
;session.save_path = "/tmp"
session.save_path = "localhost"

Relevant output of phpinfo():

Session Support enabled
Registered save handlers files user redis
Registered serializer handlers php php_binary

Directive Local Value Master Value
session.auto_start Off Off
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_httponly Off Off
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file /dev/urandom /dev/urandom
session.entropy_length 0 0
session.gc_divisor 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 0 0
session.hash_bits_per_character 5 5
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler redis redis
session.save_path localhost localhost
session.serialize_handler php php
session.upload_progress.cleanup On On
session.upload_progress.enabled On On
session.upload_progress.freq 1% 1%
session.upload_progress.min_freq 1 1
session.upload_progress.name PHP_SESSION_UPLOAD_PROGRESS PHP_SESSION_UPLOAD_PROGRESS
session.upload_progress.prefix upload_progress_ upload_progress_
session.use_cookies On On
session.use_only_cookies On On
session.use_trans_sid 0 0

Versions:
PHP - 5.4.12
Apache 2.4.4

grep VERSION php_redis.h

define PHP_REDIS_VERSION "2.2.2"

I've tried all the different ini_set that I commented out above with no luck. Any ideas on what I can do to get this working?

Owner

michael-grunder commented Aug 29, 2017

Closing this very old issue. Please reopen if it's still an issue for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment