PHP5 session_start failed, opendir permission denied.

Today i got the PHP Error:
“session_start() [function.session-start]: ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied (13) in …”.

reproduce bug:


ini_set('session.gc_probability',1000);
ini_set('session.gc_divisor',1000);

solution:

replace the commandlinke in the cron file: “/etc/cron.d/php5” with

find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f \
-cmin +$(/usr/lib/php5/maxlifetime) \
! -execdir fuser -s {} \; \
-delete

and in php code:

ini_set ('session.gc_probability', 0);

external links:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.