Martin Jašek
Martin Jašek

Reputation: 77

Connect Firebird localhost DB with php

i have firebird server and firebird database installed on windows server. port on this db is 8095. On this server i have installed PHP, and i need connect on this DB with php, here is my code which i tried but not success:

<?php

$host = 'localhost:D:\path\to\Database.FDB';
$username = 'user';
$password = 'pass';
$dbh = ibase_connect($host, $username, $password);
$stmt = 'SELECT * FROM StoreCards';
$sth = ibase_query($dbh, $stmt);
while ($row = ibase_fetch_object($sth)) {
    echo $row->Code, "\n";
}
ibase_free_result($sth);
ibase_close($dbh);

?>

can you help me please?

thanks a lot

EDIT :

working with this code :

$dbh = ibase_pconnect("ipaddr:path-to-db.FDB", "user", "pass") or die('die message');
    $q = ibase_query($dbh, "select * from StoreCards");
    while ($r = ibase_fetch_object($q)) {
        $some_value = $r->CODE;
        echo $some_value;
    }

Upvotes: 0

Views: 3942

Answers (1)

Marcodor
Marcodor

Reputation: 5771

As long as you said the Firebird runs on a non standard 8095 port (usually it is 3050), you should specify it in ibase_connect. Something like ibase_(p)connect('host/port:path_or_alias', ... Also check if the port is accessible, no block firewall rules, etc..

So:

$host = 'localhost/8095:D:\path\to\Database.FDB';

Upvotes: 1

Related Questions