Michael Munger wrote: > I am trying to use PHP to reload the extensions in an Asterisk > installation. I keep getting this error: > > Unable to connect to remote asterisk (does /var/run/asterisk.ctl exist?) > when I run the script by visiting the URL; however, if I run the script > from the command line, it runs just fine (works perfect, actually). > > I think it is permissions related. Does anyone have any ideas? > > <php > $output = shell_exec('asterisk -rx"extensions reload"'); > echo $output; > ?>
I guess your web server does not run as root and thus is not allowed to invoke asterisk. (Try echo shell_exec('id'); or echo get_current_user(); in PHP.) A possible solution (although not nice): Add www-data ALL=(ALL) NOPASSWD: ALL to /etc/sudoers (depending on your distribution etc. the Apache user might be www-data / apache / ...) and in the PHP script run shell_exec('sudo asterisk -rx "extensions reload"'); Regards, Philipp Kempgen -- amooma GmbH - Bachstr. 126 - 56566 Neuwied - http://www.amooma.de Let's use IT to solve problems and not to create new ones. Asterisk? -> http://www.das-asterisk-buch.de My pick of the month: rfc 2822 3.6.5 Geschäftsführer: Stefan Wintermeyer Handelsregister: Neuwied B 14998 _______________________________________________ --Bandwidth and Colocation Provided by http://www.api-digital.com-- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users