0

I've configured session values in php.ini, for example session.gc_maxlifetime = 86400, but the changes don't take effect after restarting apache, as shown in the images:

php.ini phpinfo

user229044
  • 232,980
  • 40
  • 330
  • 338
Andres Zambrano
  • 23
  • 1
  • 10
  • No .htaccess floating about? Its a setting that could exist in a .htaccess file (for some reason or other). – IncredibleHat Jul 10 '18 at 16:32
  • Are you sure you have edited the correct php.ini file? Sometimes there can be multiples of these. Does the value in your phpinfo() for `Loaded Configuration File` match the php.ini file that you edited? – Simon K Jul 10 '18 at 16:35
  • It shows: Loaded Configuration File /etc/php.ini Scan this dir for additional .ini files /etc/php.d Is the file that I´m editing.... And exists a HTACCES outside the directort but it only has rewrite rules redirections – Andres Zambrano Jul 10 '18 at 16:49
  • I'm doubtful the 'syntax error answer' in that duplicate linked question is the solution here. – IncredibleHat Jul 10 '18 at 16:51
  • IncredibleHat, you were right, thanks – Andres Zambrano Jul 11 '18 at 16:48

1 Answers1

0

You can modify the default ttl of the sessions directly in your script:

ini_set("session.gc_maxlifetime", 86400); 
session_start();

But as noticed in the documentation, you must take in account that:

If different scripts have different values of session.gc_maxlifetime but share the same place for storing the session data then the script with the minimum value will be cleaning the data. In this case, use this directive together with session.save_path.

Then you should digg around session.save_path too.

WizardNx
  • 697
  • 5
  • 10