title: PHP. Get user home directory (for virtual hosting)
body: <p>I want to get home directory of current script user (nginx/www/apache etc.) in PHP.
  I use </p>
  
  <pre><code>$output_message = shell_exec('echo ~');
  var_dump($output_message);
  </code></pre>
  
  <p>It's working correctly on my local server, on Amazon instances. But it outputs only "~" on virtual hosting.</p>
  
  <p>Maybe, do you have working solution for getting home directory of current user?</p>
  
  <p>Thanks in advance</p>