we have a couple of projects running on Yii1 and on Yii2 currently using lamp environment on php 7.2 plus memcache (2 memcache servers).
All apps are configured so that sessions are stored in cache, that is memcache.
On local environment (Windows host OS) we use Wamp on php 7.2 also with local memcached server (single memcache server).
We are at the process of upgrading to PHP 7.3 however, the very first step of our upgrade, the local environment, has broken.
To be more specific, since upgrading to PHP 7.3 none of the applications (either Yii1 or Yii2) seem to be consistent regarding maintaining sessions (keeping user logged in).
After a user has logged in, without using remember-me option and cookie validation, at completely random timings while refreshing the page, get’s logged out. This may be on the very next refresh or after 20 attempts, it is completely random and if you keep refreshing the page you notice that it may recover again the session at sometimes, stating that user is logged in and then losing it again.
I ve opened an issue over here
https://github.com/nono303/PHP7-memcache-dll/issues/16 since at the begining i thought it might have been a memcache issue, and later here
however, after various tests, it seems quite possible that the issue lies somewhere on Yii and not on memcache.
Runing a plain php script to test memcache (not using Yii)
$memcache = new Memcache; $memcache->connect('localhost', 11211) or die ("Could not connect"); $version = $memcache->getVersion(); echo "Server's version: ".$version."<br/>\n"; $get_result = $memcache->get('key'); echo "Data from the cache:\n"; var_dump($get_result);exit;
Configuration seems like the following (pasting from a Yii1, similar on Yii2)
'session' => array( 'class' => 'CCacheHttpSession', 'cacheID' => 'cache', 'timeout' => 600, 'cookieParams' => [ 'lifetime' => 600, // 'secure' => true, 'httpOnly' => true, ], ), 'cache' => array( 'class' => 'CMemCache', 'servers' => array( array( 'host' => 'localhost', 'port' => 11211, ), ), ),