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

Leah Newmark lnewmark at capalon.com
Wed Jun 24 15:19:13 CDT 2009


Thanks.
I didn't change anything in my dialplan. I am aware of reloading configuration :)

My AGIs are copied from a working asterisk install -- the shebang argument is how I've always done it. Either way, I have tried it without the -q as well, and that also didn't succeed.

I just tried your test and it worked fine to run it.

As I said, I know the server is reading the file I've been editing. I see it on the monitor. It's definitely opening the file to return that message...

Any other ideas?
____________________________________________________________________________
On Wed, Jun 24, 2009 at 3:43 PM, Leah Newmark<lnewmark at capalon.com <http://lists.digium.com/mailman/listinfo/asterisk-users>> 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