I have the following snippet of code in a PHP file:
echo `whoami;cd;pwd`;
When I run this script from the command line (lets call this test.php), php test.php
, I get the following output:
rohit /home/rohit
When I run this over the browser, I get:
rohit /var/www/html
I enabled UserDir mod on my apache configuration and apache is running as the user rohit
but I can't get this to work. Any suggestions?
Putting the following in a PHP file worked for me.
putenv('HOME='. PATH_TO_HOME);