nuxsmin / sysPass

Systems Password Manager
https://syspass.org
GNU General Public License v3.0
974 stars 207 forks source link

Is it possible to use Syspass with memcached as a session handler? #1728

Open hostings-vpt opened 3 years ago

hostings-vpt commented 3 years ago

sysPass Version Syspass 3.2

Describe the question Is it possible to use Syspass with memcached as a session handler?

Platform (please complete the following information):

Additional context We have been trying to implement memcached as a session handler for Syspass because we are using Docker as the platform for the application to be able to scale up in the cloud when needed and we haven't been successful. When making requests to the homepage, a 'Session cannot be initialized' error is displayed. Logs in syspass.log say:

2021-07-20 10:34:13] syspass.ERROR: logger {"message":"Could not set locale","caller":"SP\Core\Language::setLocales"}
[2021-07-20 10:34:13] syspass.EXCEPTION: logger {"message":"Session cannot be initialized
#0 /var/www/html/sysPass/app/modules/web/Init.php(284): SP\Core\Context\SessionContext->initialize()
#1 /var/www/html/sysPass/app/modules/web/Init.php(155): SP\Modules\Web\Init->initSession(Boolean)
#2 /var/www/html/sysPass/lib/SP/Bootstrap.php(232): SP\Modules\Web\Init->initialize(String)
#3 [internal function]: SP\Bootstrap->SP\{closure}(Object(Klein\Request),Object(Klein\Response),Object(Klein\ServiceProvider),Object(Klein\App),Object(Klein\Klein),Object(Klein\DataCollection\RouteCollection),Array)
#4 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(879): call_user_func(Object(Closure),Object(Klein\Request),Object(Klein\Response),Object(Klein\ServiceProvider),Object(Klein\App),Object(Klein\Klein),Object(Klein\DataCollection\RouteCollection),Array)
#5 /var/www/html/sysPass/vendor/klein/klein/src/Klein/Klein.php(588): Klein\Klein->handleRouteCallback(Object(Klein\Route),Object(Klein\DataCollection\RouteCollection),Array)
#6 /var/www/html/sysPass/lib/SP/Bootstrap.php(464): Klein\Klein->dispatch(Object(Klein\Request))
#7 /var/www/html/sysPass/lib/Base.php(75): SP\Bootstrap->run(Object(DI\Container))
#8 /var/www/html/sysPass/index.php(28): require(String)","caller":"N/A"}

Here is our memcached configuration on php.ini:

session.save_handler=memcached
session.save_path=<AWS_MEMCACHED_PATH>
memcached.sess_prefix="syspass_memc.sess.key."

Any help on this issue would be useful.

frenkye commented 1 year ago

@hostings-vpt Just came across same issue. Seems they override default memcache settings from ini inside APP. When I force this in FPM pool settings. The error goes away and sessions works.

php_admin_value[session.save_handler] = memcached
php_admin_value[session.save_path] = "127.0.0.1:11211"