Chausser Chausser - 4 months ago 34
PHP Question

Symfony calls the PHP garbage collector on Ubuntu 14.04 even when session.gc_probability is set to 0

As the title state for some reason my Symfony 2.5 Application is calling the php garbage collector even when all of my php.ini files have:

session.gc_probability = 0

Does anyone know how to prevent this from happening?

Error message im getting:

Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php5)
failed: Permission denied (13) in /<path-to-my-site>/var/cache/dev/classes.php line 432


Directive Local Value Master Value
session.gc_divisor 1000 1000
session.gc_maxlifetime 86400 86400
session.gc_probability 0 0

I know that i can just give the www-data user permission to the
folder or change the
to somewhere that the
user has access to already but i want to know why this process is even getting called when it should be disabled.


I found it, I guess the latest version of symfony is overwriting this by default when using the app_dev.php. The Symfony FrameworkBundle is setting the session.gc_probability = 1.

To change this add the following to your config.yml

        gc_probability: 0

Then clear the dev cache

php app/console cache:clear

This is where it shows the gc_probability defaulted to 1. Why they dont just read from the php.ini settings im not sure.