# I keep seeing this error everyday

**URL:** <https://forum.mautic.org/t/i-keep-seeing-this-error-everyday/4066>\
**Category:** Product Support\
**Created:** [June 2, 2016, 1:37pm UTC](https://forum.mautic.org/t/i-keep-seeing-this-error-everyday/4066 "2016-06-02T13:37:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![arjon](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@arjon](https://forum.mautic.org/u/arjon)\
**Post date:** [June 2, 2016, 1:37pm UTC](https://forum.mautic.org/t/i-keep-seeing-this-error-everyday/4066/1 "2016-06-02T13:37:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![arjon](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@arjon](https://forum.mautic.org/u/arjon)\
**Post date:** [June 2, 2016, 1:37pm UTC](https://forum.mautic.org/t/i-keep-seeing-this-error-everyday/4066/2 "2016-06-02T13:37:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![arjon](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@arjon](https://forum.mautic.org/u/arjon)\
**Post date:** [June 3, 2016, 7:26am UTC](https://forum.mautic.org/t/i-keep-seeing-this-error-everyday/4066/3 "2016-06-03T07:26:12Z")

</div>

Anyone?

---

<div class="post-metadata">

**Author:** ![arjon](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@arjon](https://forum.mautic.org/u/arjon)\
**Post date:** [June 3, 2016, 9:03am UTC](https://forum.mautic.org/t/i-keep-seeing-this-error-everyday/4066/4 "2016-06-03T09:03:51Z")

</div>

> [@11768:@MxyzptlkFishStix](#):
>
> Make sure that sessions directory is owned by the web server user.

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

---

<div class="post-metadata">

**Author:** ![arjon](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@arjon](https://forum.mautic.org/u/arjon)\
**Post date:** [June 3, 2016, 3:16pm UTC](https://forum.mautic.org/t/i-keep-seeing-this-error-everyday/4066/5 "2016-06-03T15:16:34Z")

</div>

> [@11773:@MxyzptlkFishStix](#):
>
> Are you using Apache w/ mod\_php or PHP-FPM?

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!

---

<div class="post-metadata">

**Author:** ![arjon](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@arjon](https://forum.mautic.org/u/arjon)\
**Post date:** [June 4, 2016, 6:54am UTC](https://forum.mautic.org/t/i-keep-seeing-this-error-everyday/4066/6 "2016-06-04T06:54:54Z")

</div>

> [@11782:@MxyzptlkFishStix](#):
>
> Well, it’s not an error but an PHP notice.

Sorry, what does it mean?

---

<div class="post-metadata">

**Author:** ![arjon](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@arjon](https://forum.mautic.org/u/arjon)\
**Post date:** [June 4, 2016, 7:56pm UTC](https://forum.mautic.org/t/i-keep-seeing-this-error-everyday/4066/7 "2016-06-04T19:56:32Z")

</div>

> [@11792:@MxyzptlkFishStix](#):
>
> [error handling - PHP difference between notice and warning - Stack Overflow](http://stackoverflow.com/questions/4624474/php-difference-between-notice-and-warning#4624505)

Oh so it is not critical. Thanks! 🙂

---

<div class="post-metadata">

**Author:** ![gradualchange](https://avatars.discourse-cdn.com/v4/letter/g/d9b06d/32.png) [@gradualchange](https://forum.mautic.org/u/gradualchange)\
**Post date:** [April 11, 2023, 7:14am UTC](https://forum.mautic.org/t/i-keep-seeing-this-error-everyday/4066/8 "2023-04-11T07:14:47Z")

</div>

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](https://stackoverflow.com/questions/47043351/sessionhandlergc-ps-files-cleanup-dir-permission-denied-13)

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](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 `grep`ping 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.
