Asterisk AGI (Failed to execute)

hi all…
i create a agi file (TestIvr.agi) using php. and locate it /var/lib/asterisk/agibin/ , then gives root permission.
in extension.conf file i put “exten => S,1,AGI(TestIvr.agi)”. then restart the asterisk and test…
i got following thing…
"TestIvr.agi: Failed to execute ‘/var/lib/asterisk/agi-bin/TestIvr.agi’: No such file or directory"
no errors in php file i checked it using follwing command…
"php /var/lib/asterisk/agi-bin/TestIvr.agi -v"
what is the wrong…
please help me…

thank you…
:confused:

Is it executable?

Does the first line start with #! and end with the full pathname for the PHP interpreter?

Hi david,
thank you for your advice… i set that path correctly, then file is executed but i got following error
" ERROR[3252]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe"
here is the my agi file
############################################################
#!/usr/bin/php -q

<?php ob_implicit_flush(false); set_time_limit(6); $stdin = fopen('php://stdin', 'r'); $stdlog = fopen('my_agi.log', 'w'); $debug = false; /* Read input from Asterisk and output via $astOutput */ function astRead() { global $stdin, $debug, $stdlog; $astOutput = str_replace("\n", "", fgets($stdin, 4096)); if ($debug) fputs($stdlog, "read: $input\n"); return $astOutput ; } /* Write AGI command to Asterisk */ function astWrite($agiCommand) { global $debug, $stdlog; if ($debug) fputs($stdlog, "write: $agiCommand\n"); echo $agiCommand."\n"; } /* Handling execution input from Asterisk */ $agivar = array(); while (!feof($stdin)) { $temp = fgets($stdin); $temp = str_replace("\n","",$temp); $s = explode(":",$temp); $agivar[$s[0]] = trim($s[1]); if ($temp == "") { break; } } /* Operational Code starts here */ /* Playback the demo-congrats.gsm file from the * directory /var/lib/asterisk/sounds/ */ // astWrite("STREAM FILE demo-congrats 123#"); astWrite("VERBOSE TESTXXXXXXX"); //astWrite("ANSWER"); astRead(); /* Finalization of AGI script and clean-ups */ fclose ($stdin); fclose ($stdlog); exit(0); ?>

######################################################
I get this Agi from “Asterisk Gateway Interface 1.4 and 1.6”
:confused: