phpx86centosx86-64shell-exec

How to shell_exec program_linux_i386 from PHP


I downloaded (mdldec_linux_amd64) and (mdldec_linux_i386)

and placed them somewhere in cPanel / Files Manager / HTML folder

How to call this program from Call.PHP ?

I try something like below

shell_exec ("mdldec_linux_amd64 parameter1 parameter2");

can someone help me on this?


Solution

  • Executing commands from php is not recommended, this might bring security issues. If you don't have an option here are 2 examples:

    You should try to use the full path for the file you want to execute:

    shell_execute("/usr/local/mdldec_linux_amd64 parameter1 parameter2");
    

    Assuming that the file is the /usr/local folder

    Also you can use exec and get the last returned line from the executed command. and also the full output

    $output = array();
    $lastLine = exec("/usr/local/command",$output);
    

    And you might be able to debug better and have more information