0

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?

Martijn
  • 15,791
  • 4
  • 36
  • 68
Noob Doez
  • 59
  • 6

1 Answers1

0

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, ...)

Sebastian
  • 416
  • 1
  • 6
  • 19
  • Another hint: You should always use session_regenerate_id(); after session_start(). See https://stackoverflow.com/questions/22965067/when-and-why-i-should-use-session-regenerate-id – Sebastian Aug 28 '17 at 09:32
  • I'm setting to session_set_cookie_params and it look working nice. Thank you. – Noob Doez Aug 28 '17 at 09:46