Bootstrap FreeKB - PHP - Run a command using exec
PHP - Run a command using exec

Updated:   |  PHP articles

exec can be used to run a command on the PHP server. For example, if the PHP server is a Linux system, exec could be used to run Linux command whoami.

<?php 
  exec('whoami', $output, $return_code);
  print_r($output);
  echo "Return Code = $return_code <br>";
?>

 

Which should return something like this.

Array ()
Return Code = 0

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 78c093 in the box below so that we can be sure you are a human.