Declaring Session Max Life Time in htaccess

前端 未结 2 1724
遥遥无期
遥遥无期 2021-01-18 17:45

I am wondering whether we can declare session.gc_maxlifetime setting in .htaccess for the one particular project instead of whole web server?

If so, how

2条回答
  •  攒了一身酷
    2021-01-18 18:33

    As far I can see, the gc_maxlifetime value can be set anywhere:

    http://php.net/manual/en/session.configuration.php

    http://www.php.net/manual/en/configuration.changes.modes.php

    So you could also set it via ini_set(...) in a php file included in all your pages.

    Anyway, I think your code in the .htaccess should work as well. Maybe you missed something else, for example

    php_value session.save_path "/PATH/TO/SESSIONS"
    

    where PATH/TO/SESSIONS is the path of a folder where you have 777 access permissions.

提交回复
热议问题