I am geting the following error in the Log Files from a Web App (OpenCart). Has anyone seen this? Or can I just ignore this "somewhat known bug"? I tried following other posts regarding this specific error, without success:
PHP Notice: session_start(): ps_files_cleanup_dir: opendir(/var/lib/php/session) failed: Permission denied (13)
In that dedicate server's session folder, I see:
-rw------- 1 apache apache 48 Mar 5 19:21 sess_0pl62elpgn43rjakfh6em2v2n5
-rw------- 1 apache apache 48 Mar 5 19:33 sess_2vo41urqek50ef9nl1429879i3
-rw------- 1 apache apache 125 Mar 5 18:59 sess_35goisejg3asq4n4hntcsgofu6
-rw------- 1 apache apache 48 Mar 5 19:16 sess_4cgkdiqfqgfgje356uoem0r7s3
-rw------- 1 apache apache 48 Mar 5 19:33 sess_5ji1i4kppt6ara43v8jdflcgh6
-rw------- 1 apache apache 48 Mar 5 19:34 sess_5sbl2o6ndpphh8jqogrb12v6j1
.
.
LAMP, CentOS 5, PHP 5.2
For fixing the ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permission denied issue I recommend the following two things:
To grant the write access rights for this particular folder (/var/lib/php/sessions) to the operating system.
$ sudo chmod 755 /var/lib/php/sessions
Another good solution is to set a custom location (which the PHP interpreter can write the session files to) for the session folder with the session.save-path in php.ini.
Note: Disabling the PHP’s session garbage collector with the session.gc_probability=0 PHP setting is not a good solution, because you will have a lot of orphaned session files in the session folder, and it will waste the disk space and slow down your server.
If your httpd server user/group are www-data.www-data then change:
chown -R www-data:www-data /var/lib/php/sessions
This should give httpd server ownership this directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With