[asterisk-users] how to know status of asterisk from php

Steve Edwards asterisk.org at sedwards.com
Thu Apr 28 10:41:09 CDT 2011


Un-top-posting...

> On 28 April 2011 07:19, virendra bhati <virbhati at gmail.com> wrote:

> As per you suggestion I write small php scripts but didn't get result. 
> Below is the php script and output of programs too.

> $priline = system('/usr/sbin/asterisk -rnx "pri show spans"',$pri);

> Unable to connect to remote asterisk (does /var/run/asterisk.ctl exist?) 
> priline=>Unable to connect to remote asterisk (does 
> /var/run/asterisk.ctl exist?)

On Thu, 28 Apr 2011, Tiago Geada wrote:

> The error is pretty straight forward. It is telling you that no Asterisk 
> service is running in that machine

Or...

The user that is executing the PHP script does not have write access to 
/var/run/asterisk.ctl.

Is the user executing the PHP script the same user executing the Asterisk 
process?

Changing the permission on /var/run/asterisk.ctl or executing 'sudo 
/usr/sbin/asterisk -rnx "pri show spans"' may help.

Personally, I think the 'system()' approach is a 'quick and dirty hack' 
and you really should be using AMI.

-- 
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