Php AGI library

Hi,

Anyone know of a working PHP AGI library? I mean, compatible with PHP 8 and Asterisk 18?

Thanks

I still use this library when I don’t write AGIs in C.

Are you saying it doesn’t work with PHP8 and/or Asterisk 18.

Not working for me…

PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in /var/lib/asterisk/agi-bin/phpagi.php on line 921

The library uses {} to reference arrays.

I remember I tried replacing the curly braces with squared brackets, but then I got another fatal error for another reason I forgot to write down.

I tried other PHP AGI libraries such as GitHub - welltime/phpagi: PHPAGI is a PHP class for the Asterisk Gateway Interface. The package is available for use and distribution under the terms of the GNU Public License. but got other errors there too.

Now I remember… After fixing the curly braces I also had to change the phpagi_error_handler function to use 4 parameters instead of 5 because:

errcontext
    If the callback accepts a fifth parameter, errcontext, it will be passed an array that points to the active symbol table at the point the error occurred. In other words, errcontext will contain an array of every variable that existed in the scope the error was triggered in. User error handlers must not modify the error context.
    Warning

    This parameter has been DEPRECATED as of PHP 7.2.0, and REMOVED as of PHP 8.0.0. If your function defines this parameter without a default, an error of "too few arguments" will be raised when it is called.