Noob Doez Noob Doez - 3 months ago 21
PHP Question

How to extend member session time in PHP

When I login to the site. The session closes after about a minute. I checked the php.ini file and there is no problem.

php.ini

session.gc_maxlifetime = 99999999
session.save_path = "/tmp"


This is the code in index.php

<? ob_start(); include 'functions.php'; if(isset($_GET['sess_id']) && $_GET['sess_id']!= "") { session_id($_GET['sess_id']); }


This is also function.php

ob_start();
session_set_cookie_params(0, '/', '.'.str_replace('www.','',$_SERVER['HTTPS_HOST']));
session_name('ses_name');
session_start();
error_reporting(0);
ini_set("display_errors",0);


Where do I have to fix this? What should I check?

Answer Source

Take a look at http://de.php.net/session_set_cookie_params and try to set the first parameter to a higher value like 24 hours session_set_cookie_params(24*60*60, ...)