It is possible to execute a file that .sh
in a button
, example: /bin/importa.sh
in a <a href""></a>
is also good.
It is possible to execute a file that .sh
in a button
, example: /bin/importa.sh
in a <a href""></a>
is also good.
Directly from HTML, with PHP it is possible to do this in some ways, one option is shell_exec
(not very different from system
or exec
):
<form method="post">
<button type="submit" name="button">Importar</button>
</form>
<?php
if (isset($_POST['button'])) {
shell_exec("/bin/importa.sh");
}
?>
By HTML no, you have to make a call to a PHP page and run the code snippet.
exec("/bin/importa.sh", $output);
Make sure you have the necessary permissions to run this file.
If it is freed on your server, use system()
Example:
$comando = "./bin/importa.sh";
$parametros = $_POST['parametros'];
system($comando $parametros,$retorno);
Getting $parametros
to pass to the data file for execution, it uses the function to perform bash execution
For more information: View the function page on the PHP website