PHP to store sessions on redis

Hi,

I have a problem with the Redis session. save path. I do changes in Redis for php.ini.


[Session]

; Handler used to store/retrieve data.

; https://php.net/session.save-handler

[session.save](http://session.save)_handler = redis

[session.save](http://session.save)_path = "tcp://127.0.0.1:6379"

I have this error when I do a test:


**Warning**: session_start(): Redis connection not available in **/home/user/web/domain.com/public_html/session-test.php** on line **3**

**Warning**: session_start(): Failed to read session data: redis (path: /home/user/tmp) in **/home/user/web/domain.com/public_html/session-test.php** on line **3**

Redis works!

In phpinfo.php, the path shows this path:


|[session.save](http://session.save)_handler|redis|redis|

|[session.save](http://session.save)_path|/home/user/tmp|/home/user/tmp|

What is correct for session.save_path = "?" a listening session from Redis?

  • Hestia Control Panel v1.9.3
  • Operating System Ubuntu 22.04 (x86_64)

The correct format for session.save_path when using Redis should be:

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

Restart PHP and web server after changes.

I did that, and still shows in phpinfo.php for session.save_path - /home/user/tmp

What else can I check?

We change in the php-fpm template to /home/user/tmp/…

2 Likes


That’s correct — it’s best to create a new PHP-FPM template.

You should be able to find the templates at:
/usr/local/hestia/data/templates/web/php-fpm

In your new template, make sure to remove the following line:
php_admin_value[session.save_path] = /home/%user%/tmp

1 Like

Now works!

image

Thanks!

1 Like