Hello, I am trying to execute a few shell commands, I checked and I have safe mode off, here is my code:

$pwd = shell_exec('pwd');
echo $pwd;

This page displays nothing, it does not print my directory.

    Off-hand I don't know what the problem is (you might have to search the error logs to find out, or turn on display_errors, etc.). But why not use PHP's built in [man]getcwd/man function, instead?

      It's good to put 2>&1 at the end of all your commands to see if any errors occured. Not windows' servers of course.

        Write a Reply...