1

If i am trying to execute this command from my controller :

$output = shell_exec('asterisk -rx "core show channels concise"');
echo "<pre>$output</pre>";

Nothing appears only blank page is showing. but when i run

exec('ls -la', $outputArray);
print_r($outputArray);

Output is printed fine.

I tried other methods which are mentioned here. what changes i have to make in my php.ini to run shell commands.How can I find out what is going wrong when I see no error message right away?

Community
  • 1
  • 1
Bugfixer
  • 2,547
  • 2
  • 26
  • 42
  • 1
    There may be some error . Redirect err to stdout to capture error : `$output = shell_exec('asterisk -rx "core show channels concise" 2>&1 ');`. Are you seeing any errors ? – Makesh Jul 02 '15 at 11:08
  • 2
    There are lots of possibilities how this can fail (executable not found, missing environment variables which are always set when you log in properly, etc.). Your question should be rephrased into "How can I find out what is going wrong when I see no error message right away?". – Alfe Jul 02 '15 at 11:18
  • @Makesh - Error is **Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)** – Bugfixer Jul 02 '15 at 11:18

0 Answers0