[asterisk-users] Unable to run asterisk CLI commands from php

Steve Edwards asterisk.org at sedwards.com
Sat May 9 11:30:46 CDT 2009


On Sat, 9 May 2009, Sam Hawkin wrote:

> I am trying to run the asterisk CLI commands from php.
>
> Some thing like "asterisk -rx reload".
>
> $command = "sudo asterisk -rx reload";
>
> $value1 = system($command,$retval1);

Without any output or error messages its hard to guess...

In what context is your PHP script executing?

1) As an AGI?

2) By you from a shell?

3) From cron?

There are (at least) 4 elements to consider:

1) Does your script have the execute permission set?

2) Does the executing process have a "clear path" to your script? (Do all 
of the directories in the path to your script allow the executing process 
to execute your script.)

3) Is /usr/sbin/ in the path of the executing process?

4) Is the user running the script authorized to run sudo with no password?

Thanks in advance,
------------------------------------------------------------------------
Steve Edwards      sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                             Fax: +1-760-731-3000



More information about the asterisk-users mailing list