DeadAgi and PHP no working

Hi to all.

I’ve been trying to record to mysql using DeadAgi and php,

the process look like ok, but nothing is recording in the table, but if i do the same process calling the php file from address bar record are copyed to the table:

– Executing [h@em11:1] DeadAGI(“SIP/327-095128c0”, “RToDb.php”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/RToDb.php
– AGI Script RToDb.php completed, returning 0

My php for deadAgi:
#!/usr/bin/php -q
<?
require("/var/lib/asterisk/agi-bin/database.class.php");
$db=new database(“mysql”,“localhost”,“drc1”,“root”,“area22”);

		$app_config['debug'] = 0;
		
		if ($app_config['debug']) {
			$db->debug_mode();
		}
		
		// sets SQL statement and then query
	
		$sql2=("INSERT INTO cdr(uniqueid  ,callerid) VALUES('001','Call From me')");
		$db->query($sql2);
?>

this code work fine if I do it from address bar on explorer, but not from asterisk dial plan