Running PHP7 in Apache on Ubuntu 18.04. I want to increase the default session.gc_maxlifetime
from 1440 seconds to 86400 (a day).
phpinfo()
shows the php.ini file being loaded is: /etc/php/7.0/apache2/php.ini
I edit this file, change this line:
session.gc_maxlifetime = 1440
from 1440 to 86400.
This is the only occurrence of gc_maxlifetime
in the php.ini file.
Afterwards I restart Apache, and check phpinfo()
again.
session.gc_maxlifetime
is still 1440 😢
Is there a way to find out exactly how or where PHP gets its gc_maxlifetime setting from? Or how do I permanently, globally, change the gc_maxlifetime to 86400 seconds?
2
Answers
It seems I found out how to apply the php.ini.
The root cause was that below command doesn’t reload the php.ini.
Since I’m using AWS lightsail I connected AWS lightsail console.
(It’s worth to note that.. the restart or reboot button doesn’t trigger complete reboot. So you should tap the stop button and then start button)
3. Check
session.gc_maxlifetime
through phpinfo().PS.
Anyways it’s my first time that
sudo /opt/bitnami/ctlscript.sh restart apache
doesn’t working.In addition I found out that
php -r 'echo ini_get("session.gc_maxlifetime"), "n";'
command just read current php.ini file and it doesn’t mean server’s current settings. It seems it is best to use phpinfo() to check the server’s current setting values.You need to restart the php-fpm service.