Skip to content
Advertisement

shell linux don’t execute commande

I have this command and it works fine on shell. I want to run it with php but it does not work what i missed :

edited :

$arg="arg1"; $arg2= "arg2";

echo shell_exec("sshpass -p ".escapeshellarg($arg)." ssh -t root@00.00.00.00 'asterisk -rx ".escapeshellarg($arg2)."'");

after this change no error on output but still commande not executed

edited : the original commande is like this :

sshpass -p 'arg1' ssh -t root@00.00.00.00 'asterisk -rx "arg2"'

and i want to around the probleme with external parameters but it does not work

Advertisement

Answer

Finally I found a good solution for who still search :

I installed php-ssh2 with this link (i use debian 8, php7)

blog.programster.org

and in my case i use codeigniter i follow the link to implement this class

bitbucket.org

now i can execute any commande on shell without probleme

and the probleme is solved 🙂

Hope its help someone 🙂

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement