Set TMP, TMPDIR and TEMP environment variable
sys_get_temp_dir() for example access the TMP variable and will always return /tmp instead of /var/www/clients/clientX/webY/tmp I read in the documentation of the function (http://php.net/sys_get_temp_dir), that a common way to find the temporary path is to use one of the three environment variables: TMP, TMPDIR or TEMP.
Update the php-(f)cgi-starter.master and add the following lines will fix this problem for PHP-(F)CGI:
export TMP=<tmpl_var name='document_root'>/tmp export TMPDIR=<tmpl_var name='document_root'>/tmp export TEMP=<tmpl_var name='document_root'>/tmp
I don't know how to fix this for mod_php (I not using it).