Symptoms
- Plesk Obsidian running on a Linux-based operating system
- The
/tmp
directory grows very large and contains a lot of files namedmagick-xxxxxx
files in its PHP-related subdirectories:# root@server:~# find /tmp -mtime 0 -type f -size +20M -exec du -h {} + 2>/dev/null | sort -r -h
287M /tmp/systemd-private-dad58d2003dc46f7be3e15a7d0b108c2-plesk-php80-fpm.service-hRFoZf/tmp/magick-ZzObCMs_8oJXUyrrwzU0J5dysuKlf53e
287M /tmp/systemd-private-dad58d2003dc46f7be3e15a7d0b108c2-plesk-php80-fpm.service-hRFoZf/tmp/magick-zXuukgf5zr0OHKr5zb2fxbbRmURwZvAr
287M /tmp/systemd-private-dad58d2003dc46f7be3e15a7d0b108c2-plesk-php80-fpm.service-hRFoZf/tmp/magick-ZnPsDblwmpistIoKyBxDtlaWdeHfRK7S
287M /tmp/systemd-private-dad58d2003dc46f7be3e15a7d0b108c2-plesk-php80-fpm.service-hRFoZf/tmp/magick-zlpU1JviUboC0MwpfPnJr1pBHK2yAPZD
287M /tmp/systemd-private-dad58d2003dc46f7be3e15a7d0b108c2-plesk-php80-fpm.service-hRFoZf/tmp/magick-zkgLMhivXjDOpW9DmZk24SJ7MEkRJm19
... -
The
imagick
(ImageMagick) PHP extension is enabled for the PHP versions that contain such files in Tools & Settings > PHP Settings > PHP_Handler_Name
Cause
The specific website code and its interaction with the PHP extension imagick
is generating a great number of files in the mentioned temporary directory.
The issue is not related to Plesk but, is related to ImageMagick itself, which can be confirmed in the following threads:
ImageMagick creates huge temporary files · Issue #395 · ImageMagick/ImageMagick · GitHub
carrierwave - imagemagick doesn't delete tmp files - Stack Overflow
Resolution
The recommended initial course of action is to review the website code and the specific portion of it that interacts with ImageMagick and generates these files in order to resolve the issue.
As a workaround, you can set up the automated removal of such temporary files related to ImageMagick by following these steps:
-
-
Connect to the server via SSH
-
Open the crontab editor by executing the following command:
# crontab -e
-
Add the following line to create a task which removes files like
magick-*
from the directory/tmp
every minute:* * * * * find /tmp -maxdepth 1 -type f -name "magick-*" -delete
-
Additional information
Scheduling Tasks | Plesk Obsidian documentation
How to set up a task to be executed every X minutes on a Plesk server?