session.gc_maxlifetime in PHP.ini

keat63

Well-Known Member
Nov 20, 2014
1,961
267
113
cPanel Access Level
Root Administrator
Can this setting be configured per user account, or is this server wide ?

Plesk V11+ apparently has the ability to change on a domain basis, can WHM do this ?
 
Last edited:

kodeslogic

Well-Known Member
PartnerNOC
Apr 26, 2020
549
255
138
IN
cPanel Access Level
Root Administrator
If you customize the session.gc_maxlifetime value, but do not customize the session.save_path value, the script does not use the session.gc_maxlifetime variable value.


So try a custom php.ini file with below two lines in a specific cPanel account might do a trick.
Code:
session.gc_maxlifetime = {your value}
session.save_path = "/home/{USER}/tmp"
Reference:
 

keat63

Well-Known Member
Nov 20, 2014
1,961
267
113
cPanel Access Level
Root Administrator
I'm also a member of an OS Commerce forum, where it was determined (about a year ago), that session.gc_maxlifetime was causing customers baskets to empty.
As I run my own server, I could change this setting globally, so easily fixed for me.
However, the question has arisen again, and I thought it prudent that I check if this could be done as per user account etc.
Could a Cpanel user change this setting himself, without the need to involve his host.
 

kodeslogic

Well-Known Member
PartnerNOC
Apr 26, 2020
549
255
138
IN
cPanel Access Level
Root Administrator
Yes, cPanel user may change it himself in custom php.ini under his account by modifying session.gc_maxlifetime and session.save_path as mentioned earlier.

Modifying just session.gc_maxlifetime alone might not work, both directive needs to be updated. Give a try, as I have not tried this myself I'm just following the documentation.
 

keat63

Well-Known Member
Nov 20, 2014
1,961
267
113
cPanel Access Level
Root Administrator
It states on the link that you sent, that root access is required.
A standard website owner won't have root access.
 

kodeslogic

Well-Known Member
PartnerNOC
Apr 26, 2020
549
255
138
IN
cPanel Access Level
Root Administrator
With custom php.ini at user-level it might work without root-level permission, You will have to check it with one of your cPanel account.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,300
363
Houston
As far as I am aware as long as the value is lower than the global it will be preferred. So if the .ini file in the user dir says 720 and the global .ini for the PHP version they're using is set to 1440 it will prefer 720

It's also modifiable in cPanel>>Software>>MultiPHP INI editor for cPanel users.