LaVOZs

The World’s Largest Online Community for Developers

'; How can I make a php session to never expire (in the conf file, no code) - LavOzs.Com

I would like to manage the time that a session expire to be forever.

What do I have to change In the php configuration file so this change is permanent and I don't have to implement this in all the code I write?

After I make a change in the php file, do I need to restart apache for the changes to take effect?

It is not possible to store the session infinitely unless you do not use garbage collection in php. You could try to set the php ini settings and set the time to 10 years

// set the max life time, after this, session is seen as garbage
session.gc_maxlifetime=315360000

If you have cookies enabled:

session.use_cookies=1
#session.use_only_cookies=1

// set the cookie expiration as well
session.cookie_lifetime=315360000

To avoid Int overflow, do not use a value larger than 2,147,483,647 as this is the max an Int32 can hold.

Related
How can I prevent SQL injection in PHP?
How do I implement basic “Long Polling”?
Secure hash and salt for PHP passwords
How do I expire a PHP session after 30 minutes?
How do I make a redirect in PHP?
How do I get PHP errors to display?
Dude, where's my php.ini?
How does PHP 'foreach' actually work?
What are Long-Polling, Websockets, Server-Sent Events (SSE) and Comet?