Session declaration Maximum lifetime in htaccess

I am wondering if we can declare a session.gc_maxlifetimevalue in .htaccessfor one specific project instead of the entire web server?

If so, how can we do this? How is the following code?

php_value session.gc_maxlifetime 2000

I tried and it didn’t work, and I created the file php.iniin the same directory of my project, and it didn’t work either.

Thank.

+3
source share
2 answers

Yes, session.gc_maxlifetime is a PHP_INI_ALL parameter, so you can override it in .htaccess:

php_value session.gc_maxlifetime 2000

Also make sure that the entry <Directory>in your Apache configuration supports overriding:

AllowOverride Options

, . , , , . , , , INI, session.gc_probability session.gc_divisor.

, , @Gumbo PHP 30 .

+14

, gc_maxlifetime :

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

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

, ini_set(...) php , .

, , .htaccess . , - ,

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

PATH/TO/SESSIONS - , 777 .

+2

All Articles