At 16:59 27/01/2008 -0600, Darrick Hartman (lists) wrote: >As Lonnie mentioned in an earlier email, php-cli is compiled. php-cgi is >currently installed as /usr/bin/php. If you're building from the build >environment, copy the file from sapi/cli/php to php-cli (put it on your >key disk if you want for now). > >I confirmed (using your test.php) that it works as you would expect and >differently than the php(-cgi)
Unfortunately, the CLI version compiled by AstLinux is not the real CLI version, because it preprends HTML even when called with the "-q switch on the shebang line, which is a no-no since Asterisk will call the script directly from the dialplan through AGI, and might be confused if it gets anything besides authorized responses (0 or 1, I believe): ======== CentOS 5.1 ============== [EMAIL PROTECTED] astlinux-trunk]# /usr/bin/php -v PHP 5.1.6 (cli) (built: Sep 20 2007 10:16:10) [EMAIL PROTECTED] tmp]# cat test.php #!/usr/bin/php -q <?php echo "SET CALLERID \"Derf <123>\"\n"; ?> [EMAIL PROTECTED] tmp]# /tmp/test.php SET CALLERID "Derf <123>" [EMAIL PROTECTED] astlinux-trunk]# cp build_i586/php-5.2.5/sapi/cli/php /srv/www/lighttpd/php-cli ======== AstLinux trunk 1561 ======== pbx tmp # wget http://192.168.0.3/php-cli pbx tmp # chmod 755 php-cli pbx tmp # cat /tmp/test.php #/tmp/php-cli -q <?php echo "SET CALLERID \"Derf <123>\"\n"; ?> pbx tmp # ./test.php X-Powered-By: PHP/5.2.5 Content-type: text/html pbx tmp # /tmp/php-cli -q test.php SET CALLERID "Derf <123>" ======== /etc/asterisk/extensions.conf ==== [inside] exten => 9999,1,Verbose(Name=${CALLERID(name)} number=${CALLERID(num)}) exten => 9999,n,AGI(/tmp/test.php) exten => 9999,n,Verbose(Name=${CALLERID(name)} number=${CALLERID(num)}) ======== Calling in ==== pbx*CLI> -- Executing [EMAIL PROTECTED]:1] Verbose("SIP/2000-081da3a0", "Name=Fred number=2000") in new stack Name=Fred number=2000 -- Executing [EMAIL PROTECTED]:2] AGI("SIP/2000-081da3a0", "/tmp/test.php") in new stack -- Launched AGI Script /tmp/test.php -- AGI Script /tmp/test.php completed, returning 0 -- Executing [EMAIL PROTECTED]:3] Verbose("SIP/2000-081da3a0", "Name=Derf number=456") in new stack Name=Derf number=456 == Auto fallthrough, channel 'SIP/2000-081da3a0' status is 'UNKNOWN' pbx*CLI> =================================== In this particular example, it does work, but I've read in the documentation that prepending HTML is asking for trouble. Since AGI uses STDIN/STDOUT to make Asterisk communicate with external programs, the communication is pretty basic. If you are the maintainer or php5.mk, maybe you can get some help in eg. comp.lang.php about how to compile it so AstLinux provides really the same CLI version as regular Linux distros. Sorry, I don't have the skills to help you :-/ Thanks. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Astlinux-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/astlinux-users Donations to support AstLinux are graciously accepted via PayPal to [EMAIL PROTECTED]
