I have a HTML page and that have two buttons, i need to run 2 different "sh" commands when i click on the buttons, using PHP and Ajax how can i achieve this?
2 Answers
You can ajax request to php page and use exec
<?php
// outputs the username that owns the running php/httpd process
// (on a system with the "whoami" executable in the path)
echo exec('whoami');
?>
2 Comments
Salim Ibrohimi
if he have permission to do that!
Aron
Of course, It is the basic to execute Shell command using php 👍🤔
<?php
$output = shell_exec('ls -lart');
echo "<pre>$output</pre>";
?>