PHP 使用 pdo-odbc 连接 php 和 .mdb 时出现问题
PHP Problem connecting php and .mdb with pdo-odbc
我有 php 需要 MS Access 的程序,所以我不得不使用 odbc。在本地,使用 DSN 它工作正常:
$db = new PDO("odbc:MyDSN");
我把php和odbc放在服务器远程访问也没有问题:
$db = new PDO("odbc:DRIVER=MDBTools; DBQ=Data.mdb;");
但由于某些原因我用不起它。我想将 php 与数据库一起放在服务器上,但我想将 odbc(或 odbc 驱动程序)放在客户端上,如下所示:
$db = new PDO("odbc:{127.0.0.1\foo\bar\odbc.ini}; DBQ=Data.mdb;");
我似乎暂时无法使用它。我使用 Ubuntu 64 位作为服务器,Windows 7 作为客户端
更新 1:我找到了一种方法,但它需要修改 PHP 本身(类、结构等)我希望有人可以帮助我获得替代解决方案
更新 2:另一种解决方案,但需要第三方软件。
But I can't afford to use it for some reason. I want to put php on the
server together with the database but I want to place odbc (or the
odbc driver) on the client, something like this:
驱动必须由PHP加载,也就是本场景中的"client"。也就是说,您必须为 Ubuntu.
找到合适的 MSAccess ODBC 驱动程序
检查这个 SO 线程:
ODBC connection to MS-Access on Ubuntu
我有 php 需要 MS Access 的程序,所以我不得不使用 odbc。在本地,使用 DSN 它工作正常:
$db = new PDO("odbc:MyDSN");
我把php和odbc放在服务器远程访问也没有问题:
$db = new PDO("odbc:DRIVER=MDBTools; DBQ=Data.mdb;");
但由于某些原因我用不起它。我想将 php 与数据库一起放在服务器上,但我想将 odbc(或 odbc 驱动程序)放在客户端上,如下所示:
$db = new PDO("odbc:{127.0.0.1\foo\bar\odbc.ini}; DBQ=Data.mdb;");
我似乎暂时无法使用它。我使用 Ubuntu 64 位作为服务器,Windows 7 作为客户端
更新 1:我找到了一种方法,但它需要修改 PHP 本身(类、结构等)我希望有人可以帮助我获得替代解决方案
更新 2:另一种解决方案,但需要第三方软件。
But I can't afford to use it for some reason. I want to put php on the server together with the database but I want to place odbc (or the odbc driver) on the client, something like this:
驱动必须由PHP加载,也就是本场景中的"client"。也就是说,您必须为 Ubuntu.
找到合适的 MSAccess ODBC 驱动程序检查这个 SO 线程: ODBC connection to MS-Access on Ubuntu