title: What is the difference between sys_temp_dir and upload_tmp_dir in PHP?
body: <p>Or rather, is there anyway to set the system temp directory (NOT the upload temp directory) in PHP?</p>
  
  <p>When I run</p>
  
  <pre><code>echo sys_get_temp_dir();
  </code></pre>
  
  <p>I get <code>/tmp</code>.
  When I run</p>
  
  <pre><code>ini_get('upload_tmp_dir');
  </code></pre>
  
  <p>I get the directory that I specified in my <code>php.ini</code> file. Is there anyway to change what PHP uses for the sys temp dir? </p>
  
  <p>I keep having random files show up in my <code>/tmp</code> directory. These are prefixed by "php" and then have a series of random numbers and letters. From what I can tell, these are probably being generated by PHP tmpfile or tempnam. httpd is the process that is using them when they are created. They are massive files that fill up my entire <code>/tmp</code> partition and take my server down. I can't figure out where they are coming from. I could increase the <code>/tmp</code> partition size from 500MB to 2GB but I'd rather avoid that if I can.</p>
  
  <p>I don't understand where the <code>sys_get_temp_dir()</code> is pulling <code>/tmp</code> from. Everything I search for just tells me to change the upload_tmp_dir in .ini but these are two separate things. </p>