php session failed: Permission denied (13)

devinh

Member
Sep 22, 2018
12
0
1
India
cPanel Access Level
Root Administrator
=10I am using WHM VER 82, in my PHP log I am getting following message,

PHP Notice: session_start(): ps_files_cleanup_dir: opendir(/var/cpanel/php/sessions/ea-php71) failed: Permission denied (13) in /home/sitename/public_html/folder/index.php on line <line number>
My expired session has been get cleared, but getting above said message in error log, what does it mean? how to fix it?

I am using default session save path as /var/cpanel/php/sessions/ea-php71 and folder permission is 733

session.gc_probability = 2
session.gc_divisor=100
session.gc_maxlifetime=10800

Thanks for your support
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,269
313
Houston
This happens when the garabage collection is running through cron at the same time something else is attempting to perform the same action. To resolve this session.gc_probability can be set to 0 which would disable garbage collection.

You can read about this here as well: Issues with PHP 5.3 and sessions folder
 

devinh

Member
Sep 22, 2018
12
0
1
India
cPanel Access Level
Root Administrator
setting session.gc_probability=0, will be bad idea, becoz it will have a lot of orphaned session files in the session folder after it expiry, and it will waste the disk space and slow down your server.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,269
313
Houston
Ultimately whats causing the error is garbage collection running at the same time something else is trying to clean the session. If the errors aren't causing actual issues with the site then I'd leave it - the sessions are being cleaned, you're getting the error when two separate processes are attempting the same action.