im new about firebird. I'm trying to connect between php and firebird. This is the code :
$host='192.168.12.1:D:/DB/ALFABETA.FDB';
$username='john.doe';
$password='123456789';
$database='ALFABETA';
$dbh=ibase_connect($host,$username,$password) or die (ibase_errmsg());
$sth= ibase_query($dbh) or die (ibase_errmsg());
But after i run the code in browser, the warning statement is coming up. Help. What i should do ?
Warning Statement
Warning: ibase_connect(): bad parameters on attach or create database CHARACTER SET iso-8859-1 is not defined in /var/www/fortrainingcrud/connect_db.php on line 7 bad parameters on attach or create database CHARACTER SET iso-8859-1 is not defined
I finally got the answer ! Here it is :
extension=php_interbase.dll
You aren't setting the connection charset yet you get an error about it. That suggests that PHP is taking the value from somewhere else and the first candidate is the ibase.default_charset
directive. You can see its current value with var_dump(ini_get('ibase.default_charset'));
or simply by running phpinfo()
.
You can either change the directive yourself or, even better, specify the encoding at ibase_connect()
so your code doesn't break randomly depending on server configuration.
As about iso-8859-1
, it seems the appropriate syntax for Firebird is ISO8859_1
(assuming you really want that encoding).