'Using Memcached as Session Handler in CodeIgniter randomly gives error
To work with sessions via Memcached in CodeIgniter 3, should I also configure PHP to use Memcached or just configure in CodeIgniter is that enough?
My project in CodeIgniter 3 is used with several requests via AJAX, and I've been getting the error below a lot for some random requests:
session_start(): Failed to read session data: user (path: 192.168.0.50:11211)
I will got one external servers on the same network to store all sessions. This is my session config (CodeIgniter):
$config['sess_driver'] = 'memcached';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 0;
$config['sess_save_path'] = '192.168.0.50:11211'; /*Without TCP*/
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300000;
$config['sess_regenerate_destroy'] = FALSE;
I even tried creating a PHP script with a 1000 iteration loop with session_start() and session_destroy(), but I couldn't reproduce this error. It only occurs in CodeIgniter.
On the server that I do the tests, PHP 7.4 is configured so that the session_handler is memcached.
We've also tried modifying the php/memcached configuration values (based on other questions on StackOverflow) and it didn't work.
memcached.sess_lock_retries = 10 (default=5)
memcached.sess_lock_wait_min = 150 (default)
memcached.sess_lock_wait_max = 2000 (default=150)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
