title: Php has its own /tmp in /tmp/systemd-private-nABCDE/tmp when accessed through nginx
body: <p>I found strange behaviour concerning <code>php</code> and <code>/tmp</code> folder. Php uses another folder when it works with <code>/tmp</code>. Php 5.6.7, nginx, php-fpm. </p>
  
  <p>I execute the same script in two ways: via browser and via shell. But when it is launched via browser, file is not in real <code>/tmp</code> folder:</p>
  
  <pre><code>&lt;?php
  $name = date("His");
  
  echo "File /tmp/$name.txt\n";
  
  shell_exec('echo "123" &gt; /tmp/'.$name.'.txt');
  
  var_dump(file_exists('/tmp/'.$name.'.txt'));
  
  var_dump(shell_exec('cat /etc/*release | tail -n 1'));
  </code></pre>
  
  <p><code>php -f script.php</code></p>
  
  <pre><code>File /tmp/185617.txt
  bool(true)
  string(38) "CentOS Linux release 7.0.1406 (Core)
  </code></pre>
  
  <p>Where is the file? In /tmp</p>
  
  <pre><code>$ find / -name 185617.txt
  /tmp/185617.txt
  </code></pre>
  
  <p>If access it via <code>http://myserver.ru/script.php</code> I get</p>
  
  <pre><code>File /tmp/185212.txt
  bool(true)
  string(38) "CentOS Linux release 7.0.1406 (Core)
  </code></pre>
  
  <p>But where is the file? </p>
  
  <pre><code>$ find / -name 185212.txt
  /tmp/systemd-private-nABCDE/tmp/185212.txt
  </code></pre>
  
  <p>Why does php thinks that <code>/tmp</code> should be in <code>/tmp/systemd-private-nABCDE/tmp</code>?</p>