[asterisk-users] PHP AGI Not Working and Odd Behavior

David Backeberg dbackeberg at gmail.com
Wed Jun 24 15:09:37 CDT 2009


On Wed, Jun 24, 2009 at 3:43 PM, Leah Newmark<lnewmark at capalon.com> wrote:
> Hi,
>
> I'm running asterisk 1.4.22 on a debian server.
> I have php5 installed and it works correctly command line.
> When trying to run a php script via AGI, I get messages such as:
> GI Tx >> I>
> AGI Rx << #!/usr/bin/php5 -q
> AGI Tx >> 510 Invalid or unknown command
>
> The scripts are completely executable and owned by asterisk
> -rwxr-xr-x 1 asterisk asterisk
>
> Googling is not helping much, and php seems installed perfectly. Other
> servers running the same AGIs have no such problem.
>
> I also have noticed odd behavior. When I edit an AGI, the changes aren't
> always showing up in the running of the script via asterisk.
> For example, I tried editing the bash command to read #!/usr/bin/php -q,
> and got the same response on my agi debug.
> I know for a fact it's running the script I've edited:
>  Launched AGI Script /var/lib/asterisk/agi-bin/myscript.php
> and it's not in some other directory.

Keep in mind that if you change your dialplan to call a different
script you will need to
cli> dialplan reload

Other than that, I'm not sure that it's legal to put an argument into
a shbang, as in your -q when launching php.
It's also possible you've somehow locked down php or directories way
too much. The proper test is to:
bash$ sudo -u asterisk /path/to/script.php



More information about the asterisk-users mailing list