I want to run scilab with BackDoor module from PHP script. (https://atoms.scilab.org/toolboxes/BackDoor/0.2)
When I run command in terminal
sudo scilab-adv-cli
result is something like
opening BackDoor
BackDoor: listening to commands on TCP port 27020
and scilab is still runnig, and I can connect it from octave.
But I want to run this from API. When I run in PHP script
$result = shell_exec("sudo scilab-adv-cli 2>&1");
$result is
Start
... (loading things)
Opening back door
BackDoor: listening to connections on TCP port 27020
Killed
2>&1 in the command I need for showing last line from result. (http://php.net/manual/en/function.shell-exec.php#106250)
I dont know why is this happening. When the module BackDoor wasn't installed, result was "\n\n", not "Killed". When I run never ending while, the process will showing in the list of command "top" in terminal, until I kill it. With BackDoor module process will showing up only few seconds and then ends.
I tried:
- chown www-data:www-data -R /(path to scilab folder also with backdoor files)
- chmod 777 -R /(path to scilab folder also with backdoor files)
I also tried run never ending while
$result = shell_exec("sudo scilab-adv-cli -e "i = 1; while i < 10 disp("i"); end; " 2>&1");
but few seconds after scilab start, is killed. In the last case was showed many many times "1.\n\n" and then "BackDoor: listening to connections on TCP port 27020. Killed".