Session file folder in Plesk PHP is not auto cleaned

Follow

Comments

9 comments

  • Avatar
    Robert Kühn

    How is the script called in Plesk 17? there is no such file in the cron.hourly!

    0
    Comment actions Permalink
  • Avatar
    Nick Plekhov

    Hello @Robert Kühn,

    The file mentioned in the article belongs to root's crontab.
    Please make sure that you are logged in as root or accessing the /etc/cron.hourly with sudo. Otherwise, you will see the crontab of the user you are logged in with.

    0
    Comment actions Permalink
  • Avatar
    Robert Kühn

    Thank you @Nick Plekhov,

    I just used the root user per ssh-console and even with sudo I can see only a ".placeholder" file inside. I just checked also the crontab with sudo and found only something like: /opt/psa/admin/bin/php -dauto_prepend_file=sdk.php '/opt/psa/admin/plib/modules/xovi/scripts/clear-cache.php' ..

    0
    Comment actions Permalink
  • Avatar
    Nick Plekhov

    Hello @Robert Kühn
    In this case, I suggest you create the file manually.
    The content should be as follows:
    pgrep -f ".*$0$" | grep -qv $$ && exit 0

    renice 19 -p $$ >/dev/null 2>&1

    [ -x /usr/lib64/plesk-9.0/maxlifetime ] && [ -d /var/lib/php/session ] && /usr/lib64/plesk-9.0/php_session_cleaner /var/lib/php/session $(/usr/lib64/plesk-9.0/maxlifetime)

    After the file is created change the permissions as follows:
    chmod 755 /etc/cron.hourly/plesk-php-cleanuper

     

    0
    Comment actions Permalink
  • Avatar
    Mark-Oliver Wolter

    Hello @Robert Kühn,

    the cleanup script /usr/lib/php/sessionclean is called via /etc/cron.d/php in Plesk 17.

    Same for /usr/lib/php5/sessionclean and /etc/cron.d/php5, but that one is broken in 17.8.

     

    0
    Comment actions Permalink
  • Avatar
    Alexandr Nikolaenko

    Hello,
    I would like to ensure you, that /etc/cron.hourly/plesk-php-cleanuper is the cron script for PHP session path clean up in all Plesk Onyx versions.

    0
    Comment actions Permalink
  • Avatar
    Mark-Oliver Wolter

    ls: cannot access /etc/cron.hourly/plesk-php-cleanuper: No such file or directory
    /usr/lib64/plesk-9.0 doesn't exist.
    However this does: /usr/lib/plesk-9.0/php_session_cleaner
    But there is no maxlifetime in /usr/lib/plesk-9.0/.

    Product version: Plesk Onyx 17.8.11 Update #73

    Anyway, I rewrote /usr/lib/php/sessionclean a bit so it cleans up plesk's default session dirs too, so that works for us.

    0
    Comment actions Permalink
  • Avatar
    highr0ll34

    Is it 

    /var/lib/phpXX/session or /var/lib/phpXX/sessions

    does it matter?

    0
    Comment actions Permalink
  • Avatar
    Pavel Rozental

    Hello @highr0ll34,

    Yes it's metter.

     Using below command you should find what exactly custom path for "session.save_path" is set.

    grep -ir session.save_path /opt/plesk/php/*/etc/php.ini | grep -v ";"

    Found path must exist on the server.

    This path must be used in point 4 of Resolution

    1
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request