How can I expire a PHP session after 50 minutes?

0 votes
Hii team,

How can I expire a PHP session after 50 minutes? I need to keep a session alive for 50 minutes and then destroy it.
May 19 in PHP by kartik
• 11,890 points
33 views

1 answer to this question.

0 votes

Hii @kartik,

Use the session_set_cookie_params funciton to set the session.

If necessary call this function before session_start() call.

Try this:

$lifetime = strtotime('+50 minutes', 0);

session_set_cookie_params($lifetime);

session_start();

Thank you!

answered May 19 by Niroj
• 23,950 points

Related Questions In PHP

0 votes
1 answer

How can you upload a file using PHP?

Hello, To upload a file by using PHP, ...READ MORE

answered Mar 27 in PHP by Niroj
• 23,950 points
45 views
0 votes
1 answer

How can I handle the warning of file_get_contents() function in PHP?

Hello @kartik, This is fairly simple: if (!$data = ...READ MORE

answered Apr 7 in PHP by Niroj
• 23,950 points
60 views
0 votes
1 answer

How can we track Google Analytics on a redirection page with PHP?

Hello @kartik, Since the page that is sending ...READ MORE

answered Apr 29 in PHP by Niroj
• 23,950 points
38 views
0 votes
1 answer

How can I add PHP page to WordPress?

Hii @kartik, First, duplicate post.php or page.php in your theme folder. Rename the ...READ MORE

answered May 8 in PHP by Niroj
• 23,950 points
25 views
0 votes
1 answer

What is Laravel framework? Why one should use Laravel?

Laravel is a PHP web-framework; it utilized ...READ MORE

answered Mar 17 in Laravel by Niroj
• 23,950 points
71 views
0 votes
1 answer

How to download and install Lavavel framework?

Hey @kartik, First you must have xampp install ...READ MORE

answered Mar 17 in Laravel by Niroj
• 23,950 points
67 views
0 votes
1 answer

Display Laravel in browser by using cmd promt?

Hello, First you need to have laravel install ...READ MORE

answered Mar 17 in Laravel by Niroj
• 23,950 points
33 views
0 votes
1 answer

How can we get started with Laravel through Xampp?

Hii, First you need to start Apache and ...READ MORE

answered Mar 17 in Laravel by Niroj
• 23,950 points
31 views
0 votes
1 answer

How can we create a session in PHP?

Hello @kartik, session_start() function is used in PHP to ...READ MORE

answered Mar 27 in PHP by Niroj
• 23,950 points
35 views
0 votes
1 answer

How can I connect to a Tor hidden service using CURL in PHP?

Hello @kartik, I use Privoxy and cURL to scrape Tor ...READ MORE

answered May 19 in PHP by Niroj
• 23,950 points
79 views