Question

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?

Was it helpful?

Solution

Putting the following in a PHP file worked for me.

putenv('HOME='. PATH_TO_HOME);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top