SessionHandler::gc(): ps_files_cleanup_dir | Permission denied (13)

session_start(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: permission denied (13)
opendir(/var/cpanel/php/sessions/ea-php72) failed: permission denied (13)

i have a problem with PHP7 in CentoOS (WHM/CPANEL) and Prestashop 1.7

the system gives me this messagges:

Notice on line 429 in file /home/onywf3fr9a/public_html/app/cache/dev/classes.php

[8] SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/cpanel/php/sessions/ea-php70) failed: Permission denied (13)

I have the same issue, I changed the session.save_path to "/tmp" in my php.ini

How to fix the «Notice: SessionHandler::gc(): ps_files_cleanup_dir , How to fix the «Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/​var/lib/php/sessions) failed: Permission denied (13) in  Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question.Provide details and share your research! But avoid …. Asking for help, clarification, or responding to other answers.

For fixing the

«Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir("/var/cpanel/php/sessions/ea-php70") failed: Permission denied"

I recommend to grant the write access rights for this particular folder (/var/cpanel/php/sessions/ea-php70) to the operating system account you use for the PHP interpreter.

Disabling the PHP's session garbage collector with the session.gc_probability=0 PHP setting is not a good solution, because you will have a lot of orphaned session files in the session folder, and it will waste the disk space and slow down your server.

opendir(/var/cpanel/php/sessions/ea-php56) failed: Permission , line 429: Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/​cpanel/php/sessions/ea-php56) failed: Permission denied (13). Notice: ps_files_cleanup_dir: opendir(F:\php\sessions) failed: Invalid argument (22) in on line 11 On line eleven in this script only a session_start() is called. The permissions are set correctly, because the script is able to write, edit and delete the session files with the filesystem functions.

I cleared cache and problem has been solved :)

ERROR, SessionHandler::gc(): ps_files_cleanup_dir: opendir(/tmp/.priv) failed: Permission denied (13) in /shop/system/library/session/native.php on  Posted on August 13, 2012 August 14, 2012 Author Maurits van der Schee (Innovation Engineer) Categories Symfony2 Tags php, programming, symfony2 Leave a Reply Cancel reply Your email address will not be published.

This error occurs, because you need folder permission to store your session files in the session folder.

This error is common for all popular frameworks. Solution is 1. Give permission to the session folder as showing to store files OR 2. create a local session folder in your project and rewrite the session files storing path in your project.

Permission denied (13) · Issue #16315 · PrestaShop/PrestaShop , NOTICE: PHP Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/​lib/php5/sessions) failed: Permission denied (13) - in file  setting session.gc_probability=0, will be bad idea, becoz it will have a lot of orphaned session files in the session folder after it expiry, and it will waste the disk space and slow down your server.

SessionHandler::gc(): ps_files_cleanup_dir, SessionHandler::gc(): ps_files_cleanup_dir | Permission denied (13). session_start(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: permission  We are currently performing some scheduled maintenance. We will be back as soon as possible. Please check back soon.

I keep seeing this error everyday - Support, session_start(): ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied (13). Although we hadn't yet seen this error on a live  Posted June 13, 2017 As FuenRob said. it is a server configuration problem, follow his instructions and report if solved. If not than you should contact your provider and he should solve the server configuration problem.

ps_files_cleanup_dir: Permission denied, PHP Notice: session_start(): ps_files_cleanup_dir: opendir(/var/cpanel/php/​sessions/ea-php71) failed: Permission denied (13) in  Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/cpanel/php/sessions/ea-php72) failed: Permission denied (13) in /home4/hameedia/public_html/system

Comments
  • Did you tried to make this directory writable?
  • Check your directory permissions in FileZilla
  • "ps_files_cleanup_dir" probably means that you should try to allow delete actions within this directory
  • Are there any security issues with changing the sessions folder to "tmp" instead of the 'var/cpanel/php/sessions/ea-php73' directory?
  • "because you will have a lot of orphaned session files in the session folder" --- does not debian php package come with a dedicated cron job that cleans the sessions independently of php?
  • @zerkms no, it does not. Php run it's session garbage collectors based on information set in php.init / during script execution. However you should always have dedicated directories for every project sessions, because their lifetime settings might be different, causing sessions to expire earlier than anticipated if directory is shared.
  • @SteveB well, debian and ubuntu packages come with built-in GC disabled and with an external cleanup scripts that are run via cron or systemd. Just install it and check yourself.
  • @zerkms well, you got me. Linking relevant question on servelfault for reference: serverfault.com/questions/511609/….
  • @Dmitriy Buteiko, when I grant permission as root it works but the next day I get the same exception again !!! what should I do to make it permanent ? I always run these two commandes:1- sudo chown username: -R /var/cpanel/php/sessions/ea-php70 ## 2- sudo chmod u+w -R /var/cpanel/php/sessions/ea-php70
  • I have this same error, changed the path file to /tmp in php.ini and also cleared the cache, yet the same error is showing.