session_start() [function.session-start]: ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied (13)This should only happen if you are using the native driver and your session files are stored in the default location var/lib/php5 Debian/Ubuntu has default setting of gc_probability = 0 in PHP.ini Kohana is setting gc_probability = [session.config.gc_probability] and so you get an error when a write attempt is made to var/lib/php5 which is root only.
To prevent this error, you should switch off garbage collection in session config and let debian/ubuntu cron job clean up the session files.
/**
* Percentage probability that the gc (garbage collection) routine is started.
*/
$config['gc_probability'] = 0;
This does not apply if custom save handlers are defined php manual Kohana's session (for NON native) defines it's own set_save_handler, so you must configure a gc_probability > 0 if you want old sessions cleaned up. (If you are not using the native driver.)
Debian/Ubuntu cron job does not clean up old sessions if you have specified your own file_save_path, so you would need to add that to PHP.ini. and explicitly enable gc_probability = (>0)
Report a bug to Ubuntu. They are breaking PHP functionality.
/**
* Percentage probability that the gc (garbage collection) routine is started.
*
* If you are using Debian/Ubuntu and default storage directory /var/lib/php5 then
* set here gc_probability to 0 and let Debian/Ubuntu cron job clean the directory.
*/
$config['gc_probability'] = 0;Posted By: KudosJust encountered this too, glad to find the fix so easily.
I got the same message, now im a novice to ubuntu server so any details of getting this fixed would be greatly appreciated. I have ubuntu lucid latest, the questions i have is 1.) What chmod setting should i set the dir to for /php5, 775? 755? 2.) Where is the file session.config located in ubuntu? I looked at the php.ini file but it does not indicate the line gc_probability = (>0), i know that i can edit the php.ini but i hear horror sometimes follow close to ones edits.
If you are using the native driver and your session files are stored in the default location var/lib/php5 you can recreate this error on every request by placing the following two lines in system/config/session.php:
ini_set('session.gc_probability',1000);
ini_set('session.gc_divisor',1000);
If you want to recreate the error 1 out of 2 times on average use the following
ini_set('session.gc_probability',500);
ini_set('session.gc_divisor',1000);
We spotted this problem on one of our servers. Basically the solution is to make sure the files are only deleted if nothing is using them.
We edited /etc/cron.d/php5
The command part of the crontab was this: SEE NEXT POST
[ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -delete
We changed it to: SEE NEXT POST
[ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -exec sh -c 'C=`fuser $0 2> /dev/null | wc -w`; [ "$C" -eq 0 ] && rm $0' {} \;
Instead of just deleting the file, we use fuser to see if there any processes with the file open, and only delete if there aren't.
Woot, this bug should be fixed in upcoming releases.
The previous solution I posted was not as efficient or secure as it could have been. See the bug report thread, or newer releases, for a newer version.
It looks like you're new here. If you want to get involved, click one of these buttons!