[Asterisk-Users] Reload Asterisk from php or perl script

Dee Lowndes dee at asyouneed.com
Fri Oct 8 10:30:27 MST 2004


> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-
> bounces at lists.digium.com] On Behalf Of Donny Kavanagh
> Sent: 08 October 2004 15:56
> To: Asterisk Users Mailing List - Non-Commercial Discussion
> Subject: RE: [Asterisk-Users] Reload Asterisk from php or perl script
> 
> Shoudn't you be able to use the Manager API to connect to Asterisk
over
> a socket and issue a reload that way.  This way you don't have to
worry
> about permissions what so ever, other then connection php will make.
> 
> The wiki is here http://www.voip-info.org/wiki-Asterisk+Manager+API
> 
> It gives this example which should be exactly what you want
> 
> <?php
> 
>  $socket = fsockopen("192.168.0.53","5038", $errno, $errstr,
$timeout);
>  fputs($socket, "Action: Login\r\n");
>  fputs($socket, "UserName: admin\r\n");
>  fputs($socket, "Secret: blabla\r\n\r\n");
> 
>  fputs($socket, "Action: Command\r\n");
>  fputs($socket, "Command: reload\r\n\r\n");
>  $wrets=fgets($socket,128);
> 
> ?>
> 
> 
> Donny
> 
> 
> 
> -----Original Message-----
> From: Justin B. Newman [mailto:justin.newman at binhost.com]
> Sent: Friday, October 08, 2004 9:54 AM
> To: Asterisk Users Mailing List - Non-Commercial Discussion
> Subject: Re: [Asterisk-Users] Reload Asterisk from php or perl script
> 
> 
> On 10/8/2004, "Dee Lowndes" <dee at asyouneed.com> wrote:
> >Hi,
> >
> >	I am looking for a basic script that can reload asterisk from
> >php or perl via a web browser.
> >
> >I have tried exec( asterisk -rx reload ) and shell_exec( <same cmd> )
> >with php but there seems to be a permission issue with asterisk that
> >stops these working. I was just wondering if anyone has a way around
> >this with perl or php.
> >
> 
> Dee,
> 
> If Asterisk is running as a different user than your web server, then
> you're
> not going to be able to use those scripts "outta the box".  Running
> Asterisk
> as the same user as your web server would probably be considered a
> horribly
> insecure configuration, at best.
> 
> The alternative is to explore options for allowing your webserver to
run
> programs as different userid's.  If you're running Apache, this page
may
> help:
>    http://httpd.apache.org/docs/suexec.html
> 
> Good luck!

Big big thanks to all those that have replied plenty for me to research
and work on.

Dee




More information about the asterisk-users mailing list