[asterisk-users] Using PHP to reload extensions

Mojo with Horan & Company, LLC mojo at horanappraisals.com
Thu Oct 4 16:17:46 CDT 2007


No, because then asterisk would be presented three arguments: '-rx', 
'extensions', and 'reload' -- as 'extensions' is not a command by 
itself, and the 'reload' appears superfluous to asterisk, this would not 
work as desired.

Asterisk needs to be presented two arguments - the first is '-rx', the 
second is "extensions reload" (needs additional quoting to contain the 
space) which is actually a parameter to the '-x' switch just used.
    $output = shell_exec("asterisk -rx 'extensions reload'")
is right.

Generally, the difference between single quotes and double quotes is 
that with double quotes, PHP is allowed to make $variable substitution 
while with single quotes, it is not.

Mojo


Lee Jenkins wrote:
> I'm not a PHP guy, but shouldn't the double quote be surrounding the 
> entire shell command like this?
>
> $output = shell_exec('"asterisk -rx extensions reload"');
>   




More information about the asterisk-users mailing list