Need help configuring php for asterisk

i’ve been trying to execute a php script using asterisk and the script keeps getting terminated with 0 being returned.

#!/usr/bin/php -q

<?php set_time_limit(30); include('phpagi.php'); $agi = new AGI(); $agi->answer(); //$cid = $agi->parse_callerid(); $agi->saynumber("1234"); // speaks the number 1234 $agi->hangup(); ?>

any advice on how i can get php scripts to work with my asterisk will be very much appreciated.