微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PHPAGI:执行格式错误

运行PHPagi时遇到问题:

-- Executing [123@DLPN_C:1] AGI("SIP/1000-00000001","hello_world.PHP") in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/hello_world.PHP hello_world.PHP: Failed to execute '/var/lib/asterisk/agi-bin/hello_world.PHP': Exec format error -- Auto fallthrough,channel 'SIP/1000-00000001' status is 'UNKNowN' Scheduling destruction of SIP dialog '343930130' in 32000 ms (Method: INVITE)

从命令行:

root@asterisk-test:/var/lib/asterisk/agi-bin# PHP5 -q hello_world.PHP #!/usr/bin/PHP5 -q

附加信息:

-rwxr-xr-x 1 root root 757 Mar 29 19:32 hello_world.PHP drwxrwxr-x 4 root root 4096 Mar 29 19:44 PHPagi -rwxr-xr-x 1 root root 25079 Sep 30 2010 PHPagi-asmanager.PHP -rwxr-xr-x 1 root root 2322 Sep 30 2010 PHPagi-fastagi.PHP -rwxr-xr-x 1 root root 67615 Sep 30 2010 PHPagi.PHP

hello world的来源: http : //www.eder.us/projects/PHPagi/PHPagi/api-docs/__examplesource/exsource_home_html_projects_PHPagi_PHPagi_examples_dtmf.PHP_acb7257145e4a5249182c8373cd8e848.html

PHP执行命令星号在Linux中

连接到从PHP的星号

在Red5Phone上按住button

听不到任何forms的red5phone openlaszlo

app_dial.c:dial_exec_full无法创build通道typesSIP(原因20未知)

ODBC连接错误:在asterisk * CLI中没有这样的命令“odbc show”ODBC连接失败

使用Asteriskbuild立交互式语音应答(IVR)系统的build议

星号应答机检测

让Asterisk自动打电话给我和其他人参加一个会议

更新文件描述符限制失败

执行格式错误来自/bin/bash ,星号执行hello_world.PHP作为bash脚本。

家当

如果你添加一个正确的shebang ,脚本就会被给定的PHP intepreter执行。 第一行告诉系统哪个程序应该运行脚本。

#!/usr/bin/env PHP

要测试你的脚本,请执行脚本本身,而不是PHP

root@asterisk-test:/var/lib/asterisk/agi-bin# ./hello_world.PHP

确保它是可执行的:

root@asterisk-test:/var/lib/asterisk/agi-bin# chmod +x hello_world.PHP

替代包装

创建一个执行PHP脚本的bash脚本。

例如hello_world.sh:

/usr/bin/PHP hello_world.PHP

并在Dialplan AGI("hello_world.sh")调用它。

确保shell脚本是可执行的chmod +x hello_world.sh 。

我在顶部的脚本中添加了以下代码,以便为我工作

#!/usr/bin/PHP -q

你的问题不是星号问题,而是一般的linux问题。

请从以下命令行尝试:

su asterisk -c "/var/lib/asterisk/agi-bin/hello_world.PHP"

最可能的原因:PHP路径不正确或启用了selinux,没有配置。

你可以检查你的extensions.conf或extensions_custom.conf ,如果扩展名和优先级不连续也会发生这个错误

请检查下面的例子:

[context] exten => 1,1,Answer() exten => 1,2,AGI(your-agi-script) exten => 1,3,Hangup()

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐