How to increase session timeout in php?

Cheap reseller Hosting

Sometimes php session timeouts quickly before your script execute. You can increase this time by simply editing some directives in php.ini.

First locate php.ini

root@host[~]# php -i | grep php.ini
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini

Get current session time out time

root@host[~]# grep -i session.gc_maxlifetime /usr/local/lib/php.ini
session.gc_maxlifetime = 14400
; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):

Edit php.ini

root@host [~]# vi /usr/local/lib/php.ini

Change value of session.gc_maxlifetime.

Restart httpd service!! its done

Ashish Kale

Ashish Kale is the co-founder and CEO of SARPS Technologies, an IT company that deals in web hosting, development, design, and internet marketing. His company has been named a top web hosting company in India and the USA. He's the go-to guy when organizations want help with relationship building and social media marketing.

Cheap web Hosting