我尝试对Firebird数据库运行 ibase_connect .
I try to run an ibase_connect to an firebird database.
数据库不在我的本地主机上.它运行在网络Windows服务器上.
我也有Windows,并且已连接到共享文件夹:
I have windows too and have an connection to the shared folder:
Z:\ Folder_WITH_DB.
我安装了XAMPP
- ibase扩展
- pdo firebird扩展.
我将 fbclient.dll 复制到了我的 XAMPP/php 文件夹中.
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");给出此错误
Warning: ibase_connect(): Unable to complete network request to host "Z". Failed to locate host machine. in xxx/index.php on line xxfirebird.log :
INET/INET_connect: gethostbyname (Z) failed, error code = 11004我在本地主机和服务器上的服务文件中添加了 gds_db 3050/tcp (均已重新启动),这是相同的错误.
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防火墙在服务器上被禁用.火鸟服务器和火鸟监护人的服务正在运行.
Windows Firewall is deactivated on server. Service for firebird server and firebird guardian is running.
推荐答案Firebird只能使用数据库服务器本地的数据库文件.您无法连接到网络共享上的Firebird数据库*.您需要连接到Firebird服务器.
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.
因此,如果"Z:/Folder_WITH_DB/database.fdb"的数据库位于服务器firebirdsrv中的文件夹D:\ data \ database.fdb中,则您需要连接到 firebirdsrv/3050:D:\ data\ database.fdb .我强烈建议删除网络共享.
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.
更多推荐
Firebird php无法找到主机
发布评论