Something
Emporium

Obscure error with PHP5 on Debian/Ubuntu

Obscure error with PHP5 on Debian/Ubuntu

With Debian's or Ubuntu's php5 package, you might receive this error when you call session_start():
ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied (13) in /your/file/here on line 30
Frustratingly, if you do receive this error, you'll only get it once every hundred page loads on average. Which points to the cause of the problem: automatic session garbage collection. In Debian and Ubuntu, /var/lib/php5, where the session data is stored, has permissions of drwx-wx-wt and should only be cleaned by a cron script. So, the package maintainers disable automatic session garbage collection.

But, other php5 packages (like php5-cli) don't have garbage collection disabled. If you're seeing this error, it's most likely you've just mixed up your php.ini files (or copy pasted one from somewhere). To fix things, find where your php.ini file is (phpinfo() is handy). This is usually /etc/php5/apache2/php.ini. Then edit it, and change session.gc_probability from whatever it is (most likely 1) to 0. Save, and restart Apache.
Dominic

Comments

Hi Dominic,
Worked nicely, thx a ton!
obmit
Googled the error, got to your site, made the change, fixed. Thanks :)
Tom Graham
Thanks for the info! Saved me some time :)
Alex
wow, thanks, hope that works, had that error inside an Zend Framework APP and was SO focusing on finding the error in my own app or zf :)
Hannes
Cheers for that! I hadn't seen this occur before - guess that's due to the 0.1% chance of garbage collection on my dev machine...
neil
thanks a bunch, worked like a charm!
ben
yeah, now it works! thx!
max
Hi,
its works, thanks many.
sudath
Thanx a lot for the fix! It saved me several time
Mattia
But default Ubuntu php.ini file comment says the default production value shall be 1 !
Marc
Thanks worked nice!
Richie
Thanks!
jmp
Cheers, thanks, man! This worked!