Why can't I change session.gc_maxlifetime in CPANEL?

p1p2

Member
Sep 21, 2022
8
2
3
Madrid
cPanel Access Level
Website Owner
I keep trying to increase the user's session time, but for some reason it still lasts 24 minutes, I've read that changing that variable could increase the time, do you know how to do it?
 

HostNoc

Well-Known Member
Feb 20, 2020
155
38
28
Ontario
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"

Regards
 
  • Like
Reactions: p1p2

p1p2

Member
Sep 21, 2022
8
2
3
Madrid
cPanel Access Level
Website Owner
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"

Regards
My problem is that i cant' access php.ini file because of my host. And I have tried to modify these values in php but it doesn't work, maybe I should try it on all pages, I don't know.
 

p1p2

Member
Sep 21, 2022
8
2
3
Madrid
cPanel Access Level
Website Owner
Can you elaborate more on this part:

Code:
My problem is that i cant' access php.ini file because of my host
Do you only have cPanel access to the machine and not root?
I don't understand much of this because I'm a newbie, but I can perfectly access the following sites, edit the database, create files, I'm the owner. The thing is that I have the host with another company, I don't know if that will affect the user session time.

I've tried to modify it with PHP but nothing works, and I can't find the ini.php anywhere, I guess I'll have to create a custom one, but I'm worried because I don't have much idea

1664384026157.png

1664384060869.png
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
15,307
2,440
363
cPanel Access Level
Root Administrator
Thanks for the details - you'll have to contact your hosting provider to have them help with this change as that confirms you don't have root access to the server. The provider will be able to check the logs and settings on the server and determine why that isn't working.

I'm sorry there isn't more we can do on our end for this.
 
  • Like
Reactions: p1p2

p1p2

Member
Sep 21, 2022
8
2
3
Madrid
cPanel Access Level
Website Owner
Thanks for the details - you'll have to contact your hosting provider to have them help with this change as that confirms you don't have root access to the server. The provider will be able to check the logs and settings on the server and determine why that isn't working.

I'm sorry there isn't more we can do on our end for this.
Don't worry, I really appreciate your help.

Regards
 
  • Like
Reactions: cPRex