I keep seeing this error everyday

The error found on mautic’s logs:

Code:
[2016-06-02 11:09:40] mautic.NOTICE: PHP Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php5/sessions) failed: Permission denied (13) - in file /var/www/domain.com/app/cache/prod/classes.php - at line 423 [] [] [2016-06-02 11:44:44] mautic.NOTICE: PHP Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php5/sessions) failed: Permission denied (13) - in file /var/www/domain.com/app/cache/prod/classes.php - at line 423 [] [] [2016-06-02 11:55:11] mautic.NOTICE: PHP Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php5/sessions) failed: Permission denied (13) - in file /var/www/domain.com/app/cache/prod/classes.php - at line 423 [] [] [2016-06-02 12:35:51] mautic.NOTICE: PHP Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php5/sessions) failed: Permission denied (13) - in file /var/www/domain.com/app/cache/prod/classes.php - at line 423 [] []

What does it mean? I think my emails still send (but i am not sure).

Thank you.

The error found on mautic’s logs:

[2016-06-02 11:09:40] mautic.NOTICE: PHP Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php5/sessions) failed: Permission denied (13) - in file /var/www/domain.com/app/cache/prod/classes.php - at line 423 [] [] [2016-06-02 11:44:44] mautic.NOTICE: PHP Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php5/sessions) failed: Permission denied (13) - in file /var/www/domain.com/app/cache/prod/classes.php - at line 423 [] [] [2016-06-02 11:55:11] mautic.NOTICE: PHP Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php5/sessions) failed: Permission denied (13) - in file /var/www/domain.com/app/cache/prod/classes.php - at line 423 [] [] [2016-06-02 12:35:51] mautic.NOTICE: PHP Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php5/sessions) failed: Permission denied (13) - in file /var/www/domain.com/app/cache/prod/classes.php - at line 423 [] []

What does it mean? I think my emails still send (but i am not sure).

Thank you.

Anyone?

Yeah all data on the webserver is owned by apache and the cron jobs run as apache user.

I am using Apache w/ mod_php. I don’t care about the error if it doesn’t interfere with email sending. Someone please confirm what the error is.

Thank you!

Sorry, what does it mean?

Oh so it is not critical. Thanks! :slight_smile:

This is quite an old thread, but it was never properly resolved. To understand this error, read this StackOverflow answer by cg909: php - SessionHandler::gc(): ps_files_cleanup_dir | Permission denied (13) - Stack Overflow

Relevant excerpts:

This error occurs when PHP tries to garbage collect expired sessions, but the directory containing the session files is not listable (missing the r access bit) by the user PHP runs as.

This is usually a security measure against PHP session hijacking. E.g. Debian sets the permissions for the session directory to drwx-wx-wt. These permissions allow anyone to create sessions and the user who created the session may read it again if they knows the file name (session id), but only root can get a list of all active sessions.

Distributions with this configuration normally also set up a cronjob or timer that regularly cleans up the sessions and disable the native garbage collection in php.ini: session.gc_probability = 0.

Solution: Change session.gc_probability in php.ini to 0 after verifying that your installation uses a cronjob/timer for session cleanup.

How to check whether your system is already cleaning up this directory:

  • CPanel uses /usr/local/cpanel/scripts/clean_user_php_sessions to remove expired sessions, so all CPanel installations use a cronjob.
  • Debian, Ubuntu and Linux Mint use a systemd timer phpsessionclean.timer for session cleanup.

My php.ini file already had session.gc_probability set to 0, and when I went to https://my-mautic-installation.link/s/sysinfo, I found that the local value was set to 1, overriding it.

After a grep -rn . -e 'gc_probability', I found there were php files that appear to be part of Mautic explicitly setting it to 1.

I didn’t go any further than this. Cloing the current version of the Mautic repository and grepping for the same pattern did not result in any output, so it seems to be inherited from somewhere else…

Anyway, that’s what this is. It’s the PHP garbage collector unable to collect garbage because the system is already taking care of it. Disregard the warning, and if you can, turn the garbage collector off to prevent the warning from cluttering your logs.