How to run a Bash script via PHP and match the output?

by 2 replies
4
How to run a Bash script via PHP and match the output?
#programming #bash #match #output #php #run #script
  • You do it with exec ie:

    $exec = exec('/bin/sh /bin/scripts/myscript.sh ' , $output, $return);

    and you can see the output with:

    var_dump($output);
  • Hello,

    Php has a function called shell_exec which takes a file path as a parameter. You could write the bash command in a file and call the shell_exec method with the path of that file

Next Topics on Trending Feed