Display error in cli


I need some help please I need to debug the connection of my external database, I want to show in cli if my connection is failing… I tried this command

asterisk -r
agi set debug on
core set verbose 4

But it did not display if my connection databse is failing.

in my php code I have like this

$conn = oci_connect('username', 'password','xxx.xxx.xxx.x');

 	if (!$conn) {

    		 $agi->verbose("DATABASE PROBLEM".);	

but even the agi verbose is not displaying, in cli…can you help me please how to display if there is failing connection to my database.(external db)

Thank you in advance.


Have you checked the PHP error log?


Nope It did not log. /var/log/php-script.log


Your issue it is on the PHP script but the commands you listed above are Asterisk debug commands, so they are practically useless in your case. Instead you should add error_reporting(E_ALL) to your PHP script.

Also you should use oci_error() function it will Returns the last error found.


I have this error now

PHP Fatal error: Call to undefined function oci_connect() in /var/lib/asterisk/agi-bin/oci.php on line 10


That is from the AGI itself. You may find it easier to write a test script which is not AGI that does what you need and then turning it into an AGI.