PHP Can't find tmp directory
问题 I am having problems with functions that create files in the tmp directory such as tmpfile() and tempnam() . They all seem to fail to write to tmp and return false. upload_tmp_dir is set in php ini and file uploads work fine. When debugging this error I found that sys_get_temp_dir() gets the location of the tmp directory unfortunately it's not supported in my PHP version (5.1.6). I also saw that using the following method replaces the functionality of sys_get_temp_dir() : if ( !function