A
A
Anton2016-05-17 15:49:17
linux
Anton, 2016-05-17 15:49:17

How to run bash in php?

wrote a script for sending messages
<?php
$tel = $_REQUEST['rec'];
$text = $_REQUEST['text'];
$text2 = str_replace('"', ' ', $text);
$text3 = str_replace('\r\n', '###', $text2);
exec("/home/admin/yowsup/yowsup- cli demos --yowsup --config config " .$tel.' "' .$text3. '"');
?>
but for some reason the script doesn't work.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Borisovich, 2016-05-17
@Alexufo

Probably forgot to check the rights? php has permission to execute this command?
The answer should be given by the console in any case
Redirect the console response with an error tostdout a stderrfile, add it after your line in the parameters to the end of the
current
redirecting-stderr-to-stdout

A
Aleksandr, 2016-05-17
@cyberspy

А почему строку для запуска сразу не собрать в переменную и не отдать её в качестве параметра exec()
$str = "/home/admin/yowsup/yowsup-cli demos --yowsup --config config " .$tel.' "' .$text3
exec($str)

A
Alexander Karabanov, 2016-05-17
@karabanov

Atyowsup-cli есть права на выполнение?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question