Permission denied when script is trying to execute ps_files_cleanup_dir

This is pretty common problem. I’ve encountered it on recent version of the Debian operating system. When you see something like that:

Notice:  session_start(): ps_files_cleanup_dir: opendir(/var/lib/php5/sessions) failed: Permission denied (13) in /mnt/www-data/htdocs/raportMNW/inc/bryanjhv/slim-session/src/Slim/Middleware/Session.php on line 110

You can fix that easily with following Linux commands:

sudo nano /etc/php5/apache2/php.ini

Now use CTRL+W to find following string session.save_path and configure it like that:

session.save_path = "/tmp"

Save your file using CTRL+X and restart Apache2 service:

sudo service apache2 restart

And voilà!