I think I have set everything up right. But $_SESSION variables load fine on some pages, and not at all on others. The problems only came about when I rearranged the directories to make the URL neater. Ie /account.php became /account/index.php. All pages are set to load this code at the start:
ob_start();
ini_set('display_errors',8191);
session_set_cookie_params(1800, "./" , "www.example.com", true, true);
session_save_path("/home/users/web/example/writeable-directory/");
session_start();
echo($_SESSION['username']);
Most work right, but two pages do not.
When I use the following code, it will echo test on all pages.
ob_start();
ini_set('display_errors',8191);
session_set_cookie_params(1800, "./" , "www.example.com", true, true);
session_save_path("/home/users/web/example/writeable-directory/");
session_start();
$_SESSION['username'] = "test";
echo($_SESSION['username']);