I was trying to execute this command
echo exec(\"top\");
and
echo exec(\"/usr/bin/top\");
neither works
You actually can call top and echo its output. Code that worked for me:
passthru('/usr/bin/top -b -n 1');
-b - running in batch mode
-n 1 - only one iteration