When we using Symfony\Component\Process\Process
, the command run as who?
I tried the command whoami
through Process
, but it return void???
$return = exec('whoami');
echo $return."\n"; // return [myname]
$process = new Process('whoami'); // The symfony process
echo $process->getOutput(); // return nothing @_@
Yes, it runs as user you run this command or the user of your webserver.
Your code seems a bit incomplete. I suggest adding $process->run();
before trying to get an output.