127 exit status is indicative of a missing command. Perhaps whoami
is not on the system or maybe your web server configuration has you jailed in some way or you are being restricted via safe_mode/open_basedir.
To verify you can try running:
exec('which whoami', $output, $return);
print_r($output);
echo $return;
If you are presented with an empty array and a return code of 0
, then the whoami
executable is currently inaccessible from your web server/PHP setup.
To check safe_mode, open_basedir settings, call phpinfo.