问题
I try to run an ibase_connect
to an firebird database.
The database is NOT on my localhost. It run on an network windows server.
I have windows too and have an connection to the shared folder:
Z:\Folder_WITH_DB.
I have XAMPP installed with
ibase extension
pdo firebird extension
.
I copied the fbclient.dll into my XAMPP/php folder.
But if i run this code:
$db = 'Z:/Folder_WITH_DB/database.fdb';
$username='SYSDBA';
$password='masterkey';
$dbh = ibase_connect ( $db, $username, $password ) or die ("error in db connect");
gives this error
Warning: ibase_connect(): Unable to complete network request to host "Z". Failed to locate host machine. in xxx/index.php on line xx
firebird.log:
INET/INET_connect: gethostbyname (Z) failed, error code = 11004
I added gds_db 3050/tcp
to the service file on my localhost and the server (have restarted both) and it is the same error.
Windows Firewall is deactivated on server. Service for firebird server and firebird guardian is running.
回答1:
Firebird can only use a database file local to the database server. You can't connect to a Firebird database on a network share*. You need to connect to the Firebird server instead.
So if the database of 'Z:/Folder_WITH_DB/database.fdb' is on server firebirdsrv in folder D:\data\database.fdb, then you need to connect to firebirdsrv/3050:D:\data\database.fdb
. I strongly suggest to remove the networkshare.
*: Technically a share can be used, but it is disabled by default because accessing a database from multiple servers through a network share can corrupt a database.
来源:https://stackoverflow.com/questions/35861765/firebird-php-failed-to-locate-host-machine