这是我第一次使用php函数odbc_connect(),我主要使用php / mysql。我遇到的问题是功能不起作用。我一直在阅读这个问题,我能提出的唯一解决办法就是通过php或apache来禁用odbc连接。
以下是我所知道的:
我有php安装版本5.1.6这里是来自php_info()的配置命令:
'./ configure'' - build = x86_64-redhat-linux-gnu'' - host = x86_64-redhat-linux-gnu'' - target = x86_64-redhat-linux-gnu'' - program-prefix ='' - prefix = / usr'' - exec-prefix = / usr'' - -bindir = / usr / bin''--sbindir = / usr / sbin'' - sysconfdir = / etc '' - datadir = / usr / share'' - includey = / usr / include'' - libdir = / usr / lib64'' - libdcdir = / usr / libexec'' - localstatedir = / var'' --sharedstatedir = / usr / com'' - mandir = / usr / share / man'' - infodir = / usr / share / info'' - cache-file = .. / config.cache'' - with-libdir = lib64'' - with-config-file-path = / etc'' - with-config-file-scan-dir = / etc / php.d'' - disable-debug'' - with-pic''--disable-rpath'' - without-pear'' - with-bz2'' - with-curl'' - with-exec-dir = / usr / bin'' - with -freetype-dir = / usr'' - with-png-dir = / usr'' - enable-gd-native-ttf'' - without-gdbm'' - with-gettext''--with- gmp'' - with-iconv'' - with-jpeg-dir = / usr'' - with-openssl'' - with-png'' - with-pspell'' - with-expat-dir = / usr'' - with-pcre-regex = / usr'' - with-zlib'' - with-layout = GNU'' - enabl e-exif'' - enable-ftp'' - enable-magic-quotes'' - enable-sockets'' - enable-sysvsem'' - enable-sysvshm'' - enable-sysvmsg'' - -enable-track-vars''enable-trans-sid'' - enable-yp'' - enable-wddx'' - with-kerberos'' - enable-ucd-snmp-hack''< strong> - with-unixODBC = shared,/ usr '' - enable-memory-limit'' - enable-shmop'' - enable-calendar'' - enable-dbx'' - enable-dio'' - with-mime-magic = / usr / share / file / magic.mime'' - without-sqlite'' - with-libxml-dir = / usr'' - with-xml' '--with-system-tzdata'' - with-apxs2 = / usr / sbin / apxs'' - without-mysql'' - without-gd'' - without-odbc '' - disable-dom'' - disable-dba'' - without-unixODBC '' - disable-pdo'' - disable-xmlreader'' - disable-xmlwriter'
我正在运行的脚本是IBM/Netezza Support(need log in)的直接副本:
<?php
//connect to database
$connectionstring = odbc_connect("nps01", "admin", "password");
$Query = "SELECT count(*) from _v_table";
$queryexe = odbc_do($connectionstring, $Query);
//disconnect from database
odbc_close($connectionstring);
?>
我可以使用odbc:
通过linux isql创建连接 -bash-3.2$ isql NZSQL
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
是否有unixODBC有矛盾吗?我很感激任何见解或解决问题的建议。