php session time left

If I set a session is there a way to determine the time the session will expire?
LVL 7
Robert SaylorSenior DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
No.  The session expiration time is the minimum time before the session data is erased.  There is no actual 'timer'.  Session expiration is checked only when a PHP page is run and is only erased 1 in 100 times even then.  I have session data on one of my computers that is ten years old because I rarely use PHP on it.

The purpose of Sessions in PHP is to identify user data.  It is not to time out user 'sessions' and fails miserably when someone tries to use it that way.
0
Robert SaylorSenior DeveloperAuthor Commented:
Thanks Dave. I kinda suspected that but will leave this open for others to comment. In a nice world I want to warn my logged in user before php kills the session.
0
Dave BaldwinFixer of ProblemsCommented:
PHP will not kill the session until someone requests a PHP page at the very least because that is the only time the PHP interpreter runs.  If there are no requests, the session will not expire.  If there is a request from the user, the session timeout is reset and starts all over.  We had a very long and difficult question / discussion on this last month.
0
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

Dave BaldwinFixer of ProblemsCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Robert SaylorSenior DeveloperAuthor Commented:
Thanks for posting Ray's article.
0
Dave BaldwinFixer of ProblemsCommented:
You're welcome, glad to help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.