We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to use memcache to save session?

Code:

$di->set('session', function() use($config){
    $session_save_path = "tcp://$config->memcache->host:$config->memcache->port?persistent=1&weight=2&timeout=2&retry_interval=10, ,tcp://$config->memcache->host:$config->memcache->port";
    ini_set('session.save_handler', 'memcache');
    ini_set('session.save_path', $session_save_path);
    $session = new Phalcon\Session\Adapter\Files;
    $session->start();
    return $session;
});

500 internal error