Do PHP sessions timeout by default - ie without any coding on my part would a user eventually be "logged out" after some time of inactivity?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
This question already has answers here:
Closed 2 years ago.
回答1:
It depends on the server configuration or the relevant directives session.gc_maxlifetime in php.ini
.
Typically the default is 24 minutes (1440 seconds), but your webhost may have altered the default to something else.
回答2:
You can change it in you php-configuration on your webserver.
Search in php.ini
for
session.gc_maxlifetime()
The value is set in Seconds.
回答3:
Yes, that's usually happens after 1440s (24 minutes)
回答4:
http://php.net/session.gc-maxlifetime
session.gc_maxlifetime = 1440
(1440 seconds = 24 minutes)
回答5:
You can set the session time out in php.ini. The default value is 1440 seconds
session.gc_maxlifetime = 1440
; NOTE: If you are using the subdirectory option for storing session files
; (see session.save_path above), then garbage collection does *not*
; happen automatically. You will need to do your own garbage
; collection through a shell script, cron entry, or some other method.
; For example, the following script would is the equivalent of
; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
; find /path/to/sessions -cmin +24 -type f | xargs rm
回答6:
Yes typically, a session will end after 20 minutes in PHP.