php no sesssion files in session save path /tmp

devinh

Member
Sep 22, 2018
14
0
1
India
cPanel Access Level
Root Administrator
using CENTOS 7.7 , php 7.3, whm 86.0.18 I set php session.save_path = "/tmp" but there is not session files in /tmp folder, but site working properly, where it ll be session files, why not storing in /tmp, pls help
 

GOT

Get Proactive!
PartnerNOC
Apr 8, 2003
1,772
326
363
Chesapeake, VA
cPanel Access Level
DataCenter Provider
Well, that is where they would be getting saved then. Perhaps your site is not generating session files, or perhaps its cleaning them up when done with them (which is what is supposed to happen)
 

tBartel03

Member
Apr 4, 2020
10
0
1
United States
cPanel Access Level
Root Administrator
I preemptively requested my host update Cent OS 6 to 8, they said they could only do 7...meh, okay whatever.

So I'm sitting on Cent OS 7.7 and I've read that you folks changed the PHP sessions from /tmp to /var/cpanel/php/sessions/ea-php73 for security reasons.

But several times a day I get this error:

session_start(): ps_files_cleanup_dir: opendir failed: Permission denied (13)

This error literally creates a cascading explosion of PHP errors and cripples the page load for visitors!

So I've been scrambling to try and figure the issue out. Some folks said it was a permissions issue though both the old/new server have root/root user/group permissions. The only thing different on the old server (that I am aware of) is that the session.save_path is set to /tmp.

So after attempting to change the directory back to /tmp on the new server I'm finding that my public_html/php.ini and WHM all absolutely refusing to change the path (yes, server rebooted).

Let me make one thing clear: security does NOT matter if something becomes worthless to use! I'm running WHM 86.0.18 with all updates installed. I've read this thread and as far as I can tell this PHP session bug is still an issue!

How do I force PHP to use obey me setting session.save_path to /tmp?

Edit 1: so I'm now going to try to override the php.ini files. There are several of them! Authenticated as root via PuTTY I ran find / -name '*php.ini*'.

Edit 2: so I ran grep -r "/var/cpanel/php/sessions/ea-php73" / and eventually found the file and updated it. The file was /home/example/public_html/.user.ini however I do not know if WHM/cPanel will overwrite this for any reason so I'll have to stay vigilant for a few days to make sure. I don't know if this change alone will fix the issue as it requires time to pass without the issue occurring however I know that the issue can occur several times a day so if the server can go for at least a couple of days I'll consider the issue resolved. As for cPanel employees: please test your code before deploying it! This was a serious waste of my time that I could have spent on much more important and literally life-improving activities.
 
Last edited:

tBartel03

Member
Apr 4, 2020
10
0
1
United States
cPanel Access Level
Root Administrator
I literally just found your thread after starting my own. Apparently WHM/cPanel is hard wiring the PHP sessions to /var/cpanel/php/sessions/ea-php73. This is causing some PHP clean up bug that did NOT occur on my older server when the path was /tmp. The system is refusing to set the session path to anything I set!
 

devinh

Member
Sep 22, 2018
14
0
1
India
cPanel Access Level
Root Administrator
I literally just found your thread after starting my own. Apparently WHM/cPanel is hard wiring the PHP sessions to /var/cpanel/php/sessions/ea-php73. This is causing some PHP clean up bug that did NOT occur on my older server when the path was /tmp. The system is refusing to set the session path to anything I set!
for me site working properly, sessions are working, but I couldn't find session files in /tmp folder
 

devinh

Member
Sep 22, 2018
14
0
1
India
cPanel Access Level
Root Administrator
finally I find session save location.. by using following method..
in php echo 'sess_'.session_id() ;
in linux search about out put, find / -name 'sess_6b966dbe1ceb5fd9c578a29aaf20c7a7'
you can find location :)

**************result
/var/tmp/systemd-private-68f3ed4d63284150b4d8d6dd7b9d971a-ea-php73-php-fpm.service-6lwJY3/tmp/sess_6b966dbe1ceb5fd9c578a29aaf20c7a7
/tmp/systemd-private-68f3ed4d63284150b4d8d6dd7b9d971a-ea-php73-php-fpm.service-6lwJY3/tmp/sess_6b966dbe1ceb5fd9c578a29aaf20c7a7
**************
verdict, when we use php along with FPM, sesssion files saved in different manner ...
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,300
363
Houston