php-agi doesn’t execute properly and gives no output.

This is problem becomes a headache to most of the asterisk developers as it does not show any kind of error but still the agi script does not execute properly with no output.

It happens because of the version incompatibility of asterisk AGI and PHP. If by executing the script from the command line ( php index.php e.g.) it gives the following error:

“PHP Parse error: syntax error, unexpected T_GOTO, expecting T_STRING in /var/lib/asterisk/agi-bin/phpagi.php on line 1207”

go to line 1207 in phpagi.php which shows this line: function goto($context, $extension=’s’, $priority=1)

 

just prefix an underscore before the function name like this:

function _goto($context, $extension=’s’, $priority=1)

 

and done!!!