PHP. Get user home directory (for virtual hosting)

Viewed 14102

I want to get home directory of current script user (nginx/www/apache etc.) in PHP. I use

$output_message = shell_exec('echo ~');
var_dump($output_message);

It's working correctly on my local server, on Amazon instances. But it outputs only "~" on virtual hosting.

Maybe, do you have working solution for getting home directory of current user?

Thanks in advance

3 Answers
Related