8000 PHP Warning: Unknown: Failed to write session data (redis) · Issue #188 · phpredis/phpredis · GitHub
[go: up one dir, main page]

Skip to content

PHP Warning: Unknown: Failed to write session data (redis) #188

New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
julienbornstein opened this issue May 22, 2012 · 18 comments
Closed

PHP Warning: Unknown: Failed to write session data (redis) #188

julienbornstein opened this issue May 22, 2012 · 18 comments

Comments

@julienbornstein
Copy link

I'm trying to use redis for session handler.

PHP Warning:  Unknown: Failed to write session data (redis). Please verify that the current setting of session.save_path is correct (tcp://127.0.0.1:6379?weight=1) in Unknown on line 0

also tried with :

session.save_path = "127.0.0.1:6379"
session.save_path = "tcp://127.0.0.1:6379"
session.save_path = "tcp://127.0.0.1:6379/" (this one crash)

but failed....

But I can use redis functions

this work

$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
$test = $redis->set('mytest', 'myvalue');
$test = $redis->get('mytest');
echo (print_r($test,1));

config in php.ini :

session.save_handler = redis
session.save_path = "tcp://127.0.0.1:6379?weight=1"

Using Ubuntu 11.10 + PHP-FPM (5.3.10-1ubuntu3.1) + nginx (1.1.19-1)

@dmitry-saritasa
Copy link

It seems I have the same issues with sessions, slightly different. But it looks like recent revision has issues with session management. See what's happening on my side

#184

@slucky
Copy link
slucky commented Jun 17, 2012

I am has same error, if i run "redis-server" under user which not access to write to redis folder (not under user "root" in my case). Error appears after some time.

@marcghorayeb
Copy link

I am also affected by this issue... any ip different from 127.0.0.1 just fails ...

@ocrdeveloper
Copy link

Same issue here as well. I watched the logs as I was running redis-server as well and when the session should attempt to connect, it doesn't even reach the redis server. However, there is no issue using the redis object. redis-server see's the connection, just not for sessions.

I should note than it works just fine with "localhost", just not for any host other than localhost.

@marcghorayeb
Copy link

any update on this? this is really annoying :(

@ocrdeveloper
Copy link

What version of PHP are you using? It seems to work for me using version 5.3.15 however, when using version 5.4.x, I continue to get this issue.

@marcghorayeb
Copy link

i'm using 5.3.15

@nicolasff
Copy link
Member

Another related issue was fixed a month ago or so; are you all running the latest version?
Thanks.

@ocrdeveloper
Copy link

I just tested this again on my laptop (Fedora 17 running php 5.4.5 and it is working just fine. Here is the test code I use that worked with no problems:

ini_set('session.save_handler', 'redis');
ini_set('session.cookie_domain', '.localhost.localhost');
ini_set('session.save_path', 'localhost');
session_set_cookie_params(0, '/', '.localhost.localhost');
session_name('localhostest');
session_start();

We have success :-)

@marcghorayeb did you try running phpize on the most recent version? Seemed to fix the issue here.

@marcghorayeb
Copy link

will try that, i'll get back to you

@galanonym
Copy link

This warning is also thrown when you forget to supply your auth key for Redis.

ini_set('session.save_path','tcp://localhost:6379?auth=your_redis_auth_key');

@claudod
Copy link
claudod commented Feb 16, 2014

I had the same issue and I've just fixed it.
In my case it was a redis version problem. My Debian Squeeze apt pkt manager had installed an old version (1.2.6), while today we are at the 2.4.15!
Upgrade your version for instance following this tutorial https://chris-lamb.co.uk/posts/official-redis-packages-debian-squeeze , restart redis-server and... hope it'll work!

@greensolid
Copy link

I had the same issue until I noticed that the auth key mustn't include specific special chars.

@giondo
Copy link
giondo commented Oct 23, 2014

I just got the same issue,
the solutions was to disable auth, I wasn't able to make it work with auth enabled on the redis-server

@garylab
Copy link
garylab commented Jan 4, 2017

In my case, session.gc_maxlifetime was the reason. I get the error because session.gc_maxlifetime was set to 144000000000. it will overflow and become a non-positive expire time passed to Redis.

These just delete the key, see: https://redis.io/commands/expire.

I had tested that the maximum expire time in Redis was 2147483647 (0x7fffffff).

So, I solved this issue by set session.gc_maxlifetime = 3600.

Other issue explain same problem: #184

@yatsukhnenko
Copy link
Member

Old issue without any activity for a long time.

@Emik123dsa
Copy link

If it still works for somebody,
I actually could resolve this issue with truncating my password, when I have generated it with openssl.
session.save_path="tcp://localhost:6379?auth=xxxx", cause it didn't work before.

@choironguk
Copy link
choironguk commented Dec 8, 2021

i had the same problem.
maybe you can try to below in php.ini set like this and then it's working
session.save_path = "tcp://localhost:6379?database=10"

i was setup session.save_path = "tcp://127.0.01:6379?database=10" and then Appeared this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0