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

2 replies
How to run a Bash script via PHP and match the output?
#bash #match #output #php #run #script
Avatar of Unregistered
  • Profile picture of the author roboscripts
    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);
    {{ DiscussionBoard.errors[11340758].message }}
  • Profile picture of the author divyakochar
    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
    Signature
    {{ DiscussionBoard.errors[11341254].message }}
Avatar of Unregistered

Trending Topics