# Session\_start(): ps\_files\_cleanup\_dir: opendir(/var/lib/php5) failed: Permission denied (13)

**URL:** <https://community.dreamfactory.com/t/session-start-ps-files-cleanup-dir-opendir-var-lib-php5-failed-permission-denied-13/935>\
**Category:** GitHub Installers\
**Created:** [March 19, 2015, 9:32am UTC](https://community.dreamfactory.com/t/session-start-ps-files-cleanup-dir-opendir-var-lib-php5-failed-permission-denied-13/935 "2015-03-19T09:32:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BeerBeer](https://avatars.discourse-cdn.com/v4/letter/b/c67d28/32.png) [@BeerBeer](https://community.dreamfactory.com/u/BeerBeer)\
**Post date:** [March 19, 2015, 9:32am UTC](https://community.dreamfactory.com/t/session-start-ps-files-cleanup-dir-opendir-var-lib-php5-failed-permission-denied-13/935/1 "2015-03-19T09:32:01Z")

</div>

Hi,

I’m running DreamFactory on Debian and regularly face this error. Not only is it annoying, it also terminates active sessions.  
This is something that should not happen unless the PHP-application overrides the “session.gc\_probability = 0” setting from the php.ini.

What exactly does DF do here?

---

<div class="post-metadata">

**Author:** ![jeffreystables](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/jeffreystables/32/173_2.png) [@jeffreystables](https://community.dreamfactory.com/u/jeffreystables)\
**Post date:** [April 8, 2015, 7:43pm UTC](https://community.dreamfactory.com/t/session-start-ps-files-cleanup-dir-opendir-var-lib-php5-failed-permission-denied-13/935/2 "2015-04-08T19:43:07Z")

</div>

On what version of PHP are you running DSP 1.9.1 when you get this error?

---

<div class="post-metadata">

**Author:** ![jeffreystables](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/jeffreystables/32/173_2.png) [@jeffreystables](https://community.dreamfactory.com/u/jeffreystables)\
**Post date:** [April 9, 2015, 3:51pm UTC](https://community.dreamfactory.com/t/session-start-ps-files-cleanup-dir-opendir-var-lib-php5-failed-permission-denied-13/935/3 "2015-04-09T15:51:53Z")

</div>

This is a common issue on Debian and its derivatives, because Debian uses a cron job for session cleanup rather than leaving it to Apache/PHP like other environments typically do. Typically this error is seen because the default permissions of the sessions directory aren’t configured for this, and eventually there is a garbage collection conflict.

A quick Google search provides two possible ways of resolving this. (There may be more.)

1. [Change permissions on the directory in question.](http://ubuntuforums.org/showthread.php?t=1817015)
2. [Edit garbage collection probability setting in `php.ini`.](http://www.webtechquery.com/index.php/2012/12/notice-session_start-ps_files_cleanup_dir-opendirvarlibphp5-failed-permission-denied/)

---

<div class="post-metadata">

**Author:** ![Kevin\_Mcgahey](https://avatars.discourse-cdn.com/v4/letter/k/b3f665/32.png) [@Kevin\_Mcgahey](https://community.dreamfactory.com/u/Kevin_Mcgahey)\
**Post date:** [April 3, 2020, 6:23pm UTC](https://community.dreamfactory.com/t/session-start-ps-files-cleanup-dir-opendir-var-lib-php5-failed-permission-denied-13/935/4 "2020-04-03T18:23:13Z")

</div>

A great [article](https://www.leaseweb.com/labs/2012/08/ps_files_cleanup_dir-permission-denied/) has been published on this error particularly. In summary, the error is caused by PHP is trying to delete the session files while this is also being done by a cronjob put on the system by the Debian package maintainers of PHP.

The easiest solution is changing the permissions which is typically www-data:www-data.

```auto
chown -R www-data.www-data /var/lib/php5

```
