We help IT Professionals succeed at work.

Session time out quickly.

Rajesh Joshi
Rajesh Joshi asked
on
155 Views
Last Modified: 2017-04-21
I have used code like this

<?php
session_start();
if  (($_SESSION['isLogged'] == "true")&& ($_SESSION['roll'] == 1)) {  
 	} else {
   header("location:login.php"); 
  die(); 
}
?>

Open in new window


But within a few seconds the session expires, so it redirect to login page. I need 10 Min to expire the session.

I have also created php.ini in kept in root directory which says
ini_set('session.gc_maxlifetime', 600);


session_set_cookie_params(600);

session_start(); // ready to go!

Open in new window

Comment
Watch Question

Dave BaldwinFixer of Problems
CERTIFIED EXPERT
Most Valuable Expert 2014

Commented:
Something else is going on, it doesn't work that way.  Also your 'php.ini' code is not in the correct format for 'php.ini' which contains statements but not PHP functions.

Author

Commented:
Hi Dave Baldwin,

Thank you for your reply. Please guide me in details for the solution.
Most Valuable Expert 2011
Author of the Year 2014
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Hi Dave Baldwin & Ray Paseur.

Can you please guide me, session variables expires very soon.

With regards,
Rajesh Joshi.
Most Valuable Expert 2011
Author of the Year 2014

Commented:
Please consider hiring a professional developer.  Maybe use E-E Gigs. You can waste years of your life trying to learn all the things a professional already knows, or you can get a professional on your team right now!

Author

Commented:
Hi Ray Paseur,

Thank you for such unexpected answer.

I know php / mysql scriting very well, the only problem is with session time out problem.

With regards,
Rajesh.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.