Question
How to change the directory for temporary PHP files of a particular PHP version in Plesk?
Answer
-
-
Go to Tools & Settings > PHP Settings > select a required PHP version (no matter CGI, FastCGI or FPM) > switch to the php.ini tab.
Note: On a Plesk server, the
php.ini
file location is/opt/plesk/php/X.X/etc/php.ini
, where X.X – a PHP version. -
Find the directive
upload_tmp_dir
: Uncomment the line and change its value to a required path. In this example it is “/var/tmp”:; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; http://php.net/upload-tmp-dir
upload_tmp_dir = /var/tmp -
Additionally for PHP versions 5.6 and greater, find the directive
sys_temp_dir
: Uncomment the line and change its value to a required path. In this example, it is “/var/tmp”:; Directory where the temporary files should be placed.
; Defaults to the system default (see sys_get_temp_dir)
sys_temp_dir = "/var/tmp" -
Click OK to apply the changes.
-
Now, add the new path (in this example, it is “/var/tmp”) to
open_basedir
of all domains, so that PHP scripts can access this directory. Use this KB article for assistance.Note: In this example, the record to be added to the php.txt file will be:
open_basedir = {WEBSPACEROOT}{/}{:}{TMP}{/}:/var/tmp