• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Ubuntu 12.04 + Apache 2.2 + PHP: No garbage collection for session files?

B_P

Regular Pleskian
Dear community,

on my (virtual) Ubuntu Server (12.04.5 LTS), I am running the latest Plesk version (12.0.18 Update #35). For "normal" web use, I am running Apache (2.2.22) and PHP (5.3.10-1ubuntu3.16) as a FastCGI module.

Since I was just checking a couple of other servers regarding PHP session management, I also checked this server. What I found out is that on this server probably no session file garbage collection takes place:

The basic PHP configuration (I didn't touch it so far) is done through files located /etc/php5/cgi with its basic PHP configuration file php.ini. Running phpinfo() confirmed the session settings done in php.ini:

[Session]
session.save_handler = files
session.save_path = /var/lib/php5
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.gc_probability = 0

With these settings (gc_probability = 0), I assume that no automatic garbage collection is started from within PHP (see also http://serverfault.com/questions/51...s-with-a-cron-job-instead-of-using-phps-built). As posted in the link before, Debian and Ubuntu normally have their own scripts in /etc/cron.d/php5 to do this garbage collection.

On my Plesk server with no personal modifications towards PHP however, neither the automated garbage collection (in php.ini) is activated, nor does the (standard) Ubuntu/Debian cron job exists to delete outdated session files in /var/lib/php5. This results in many outdated files filling up that directory on my server.

My questions now are:
1) Is the removal of the cron job /etc/cron.d/php5 something specific that happened during the installation of Plesk? Why?
2) Is there another (Plesk-specific) script that should do the work?


Thanks in advance for your help!

Bastian
 
Update: I restored the corresponding cron job as it is normally installed under Ubuntu. However, I am still wondering why the file and cron job did not exist. Any ideas?
 
Hello,

Plesk installs it's own "garbage collection" hourly cron job:
/etc/cron.hourly/plesk-php-cleanuper
It's a simple shell script, so you can easily check how does it work.

Also please check: http://kb.odin.com/en/119500
 
Hello,

Plesk installs it's own "garbage collection" hourly cron job:
/etc/cron.hourly/plesk-php-cleanuper
It's a simple shell script, so you can easily check how does it work.

Hello dash,

thanks for the reply. I just checked my system and found out that the directory /etc/cron.hourly/ is completely empty, i.e., also plesk-php-cleanuper does not exist (it seems as if this file doesn't exist anywhere in my file system.

Which package would I need to re-install to also get that file?

Thanks for your support,

B_P
 
Hello,
yep, that's my mistake - plesk-php-cleanuper script is used on rpm systems like Centos.

I've checked my Plesk 12 on Ubuntu 12 instance:
/etc/cron.d/php5 is used to clean up php sessions.
This file belongs to php5-common package from Ubuntu repo.

# apt-file search /etc/cron.d/php5
php5-common: /etc/cron.d/php5

# apt-cache policy php5-common
php5-common:
Installed: 5.3.10-1ubuntu3.16
Candidate: 5.3.10-1ubuntu3.16
Version table:
*** 5.3.10-1ubuntu3.16 0
500 http://mirror.plesk.ru/ubuntu/ precise-updates/main amd64 Packages
500 http://mirror.plesk.ru/ubuntu/ precise-security/main amd64 Packages
100 /var/lib/dpkg/status
5.3.10-1ubuntu3 0
500 http://mirror.plesk.ru/ubuntu/ precise/main amd64 Packages
 
Back
Top