我已经安装了ignite 2.7,nginx,php7.0-fpm。
我还安装了unixodbc,unixodbc-dev,libtool,automake,libssl-dev和m4。
odbc安装程序查看了官方主页并进行了跟踪,但是出现了问题。
cat odbc.ini // // odbcinst.ini // .odbc.ini(全部相同)
[Apache Ignite]
Description=Apache Ignite
DSN=Apache Ignite
Driver=/usr/local/lib/libignite-odbc.so
Setup=/usr/local/lib/libignite-odbc.so
DriverODBCVer=03.00
FileUsage=0
UsageCount=1
尾巴/ etc / profile
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export LD_LIBRARY_PATH=/usr/local/lib/
ldd /usr/local/lib/libignite-odbc.so
linux-vdso.so.1 => (0x00007ffef07c0000)
libignite-binary-2.7.0.33575.so.0 => /usr/local/lib/libignite-binary-2.7.0.33575.so.0 (0x00007fd8b8d4d000)
libodbcinst.so.2 => /usr/lib/x86_64-linux-gnu/libodbcinst.so.2 (0x00007fd8b8b3b000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd8b87b9000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd8b83ef000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd8b81d9000)
libignite-common-2.7.0.33575.so.0 => /usr/local/lib/libignite-common-2.7.0.33575.so.0 (0x00007fd8b7fc2000)
libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007fd8b7db8000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd8b7b9b000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd8b7892000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd8b9227000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd8b768e000)
ex.php
<?php
try {
// Connecting to Ignite using pre-configured DSN.
$dbh = new \PDO('odbc:Driver=Apache Ignite;ADDRESS=127.0.0.1:10800;Cache =default');
// Changing PDO error mode.
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Preparing query.
$dbs = $dbh->prepare('INSERT INTO city (id, name) VALUES (?, ?)');
// Declaring parameters.
$key = 777;
$firstName = "James";
// Binding parameters.
$dbs->bindParam(1, $key);
$dbs->bindParam(2, $firstName);
// Executing the query.
$dbs->execute();
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "\n";
die();
}
?>
localhost / ex.php
错误!:SQLSTATE [01000] SQLDriverConnect:0 [unixODBC] [驱动程序管理器]无法打开lib'/usr/local/lib/libignite-odbc.so':找不到文件
我不知道该怎么办。 谢谢您的帮助。
答案 0 :(得分:0)
尝试改用PHP Thin Client,这需要较少的配置工作: https://apacheignite.readme.io/docs/php-thin-client
如果仍然需要PHP PDO,则Ignite ODBC专家应介入。