<?php
function bdr_start_session()
{
    if (session_status() !== PHP_SESSION_NONE) {
        return;
    }

    $savePath = session_save_path();
    if ($savePath === '' || !is_dir($savePath) || !is_writable($savePath)) {
        $savePath = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'session_store';
        if (!is_dir($savePath)) {
            mkdir($savePath, 0700, true);
        }
        session_save_path($savePath);
    }

    session_set_cookie_params(0, '/');
    session_start();
}
