1
votes

I have Cs Cart Multi vendor. I upgraded my PHP 5.5 to PHP 7.0. And have error:

865 FastCGI sent in stderr: "PHP message: PHP Warning: session_start(): Session callback expects true/false return value in /var/www/cscart/app/Tygh/Session.php on line 341 PHP message: PHP Fatal error: session_start(): Failed to initialize storage module: user (path: /var/lib/php/sessions) in /var/www/cscart/app/Tygh/Session.php on line 341" while reading response header from upstream, client: 49.189.136.11, server:

Directory /var/lib/php/sessions has 0777. On other sites session works fine.

File Session.php:

 /**
 * Starts session
 * @param array $request Request data
 */
public static function start($request = array())
{
    // Force transfer session id to cookies if it passed via url
    if (!empty($request[self::$_name])) {
        self::setId($request[self::$_name], false);
    } elseif (empty($_COOKIE[self::$_name])) {
        self::setId(self::_generateId());
    }

    session_name(self::$_name);
    session_start();


    // Session checker (for external services, returns "OK" if session exists, empty - otherwise)
    if (!empty($request['check_session'])) {
        die(!empty($_SESSION) ? 'OK' : '');
    }

    // Validate session
    if (!defined('SKIP_SESSION_VALIDATION')) {
        $validator_data = self::getValidatorData();
        if (!isset($_SESSION['_validator_data'])) {
            $_SESSION['_validator_data'] = $validator_data;
        } else {
            if ($_SESSION['_validator_data'] != $validator_data) {
                session_regenerate_id();
                $_SESSION = array();
            }
        }
    }

    // _SESSION superglobal variable populates here, so remove it from global scope if needed
    if (Bootstrap::getIniParam('register_globals')) {
        Bootstrap::unregisterGlobals('_SESSION');
    }

}

Server: NGINX, PHP7.0-FPM

2

2 Answers

3
votes

session_start() uses any handlers you've previously set with session_set_save_handler(...), and that handler (or the individual functions) must return a true/false result to signal success or failure. You have a handler that does not return a true/false result.

To recap; the actual error is the implementation of your session handler, not the code that calls session_start().

0
votes

if you user session_handler , for_example, SessionRedisHandler Class,the open function must return true。I solve this problem in php7.0。