#php #odbc #alpine
Вопрос:
Привет всем, у меня проблема с подключением моего PHP к соединению netezza. Я установил odbc netezza для требуемой зависимости, а затем убедился, что мой файл so работает идеально, используя команду ldd
sh-4.3# ldd /nz/lib64/libnzodbc.so
linux-vdso.so.1 (0x00007ffdf15cd000)
libc.so.6 => /usr/glibc-compat/lib/libc.so.6 (0x00007f846827c000)
libm.so.6 => /usr/glibc-compat/lib/libm.so.6 (0x00007f8468136000)
libpthread.so.0 => /usr/glibc-compat/lib/libpthread.so.0 (0x00007f8468115000)
libdl.so.2 => /usr/glibc-compat/lib/libdl.so.2 (0x00007f846810f000)
libkrb5.so.3 => /nz/lib64/libkrb5.so.3 (0x00007f8467f2f000)
libkrb5support.so.0 => /nz/lib64/libkrb5support.so.0 (0x00007f8467e22000)
libcom_err.so.3 => /nz/lib64/libcom_err.so.3 (0x00007f8467d1d000)
libk5crypto.so.3 => /nz/lib64/libk5crypto.so.3 (0x00007f8467bda000)
/usr/glibc-compat/lib64/ld-linux-x86-64.so.2 (0x00007f8468731000)
libresolv.so.2 => /usr/glibc-compat/lib/libresolv.so.2 (0x00007f8467bc1000)
Это моя библиотека ODBC, которую я установил.
sh-4.3# odbcinst -j
unixODBC 2.3.4
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
И это моя информация о PHP, и, конечно, внутри моего PHP я установил библиотеку ODBC для PHP.
sh-4.3# php -i | grep odbc
Configure Command => /home/buildozer/aports/community/php5/src/php-5.6.40/configure '--build=x86_64-alpine-linux-musl' '--host=x86_64-alpine-linux-musl' '--prefix=/usr' '--sysconfdir=/etc/php5' '--localstatedir=/var' '--with-layout=GNU' '--with-config-file-path=/etc/php5' '--with-config-file-scan-dir=/etc/php5/conf.d' '--enable-inline-optimization' '--disable-debug' '--disable-rpath' '--disable-static' '--enable-shared' '--mandir=/usr/share/man' '--with-pic' '--program-suffix=5' '--disable-cli' '--enable-cgi' '--enable-cli' '--with-pear' '--with-readline' '--enable-phpdbg' '--enable-bcmath=shared' '--with-bz2=shared' '--enable-calendar=shared' '--with-cdb' '--enable-ctype=shared' '--with-curl=shared' '--enable-dba=shared' '--with-db4=shared' '--enable-dom=shared' '--with-enchant=shared' '--enable-exif=shared' '--with-freetype-dir=shared,/usr' '--enable-ftp=shared' '--with-gd=shared' '--enable-gd-native-ttf' '--with-gdbm=shared' '--with-gettext=shared' '--with-gmp=shared' '--with-iconv=shared' '--with-icu-dir=/usr' '--with-imap=shared' '--with-imap-ssl=shared' '--enable-intl=shared' '--with-jpeg-dir=shared,/usr' '--enable-json=shared' '--with-ldap=shared' '--enable-libxml=shared' '--enable-mbregex' '--enable-mbstring=all' '--with-mcrypt=shared' '--with-mysql=shared,mysqlnd' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-mysqli=shared,mysqlnd' '--with-openssl=shared' '--with-pcre-regex=/usr' '--enable-pcntl=shared' '--enable-pdo=shared' '--with-pdo-mysql=shared,mysqlnd' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-pgsql=shared' '--with-pdo-sqlite=shared,/usr' '--with-pgsql=shared' '--enable-phar=shared' '--with-png-dir=shared,/usr' '--enable-posix=shared' '--with-pspell=shared' '--with-regex=php' '--enable-session' '--enable-shmop=shared' '--with-snmp=shared' '--enable-soap=shared' '--enable-sockets=shared' '--with-sqlite3=shared,/usr' '--enable-sysvmsg=shared' '--enable-sysvsem=shared' '--enable-sysvshm=shared' '--with-unixODBC=shared,/usr' '--enable-xml=shared' '--enable-xmlreader=shared' '--with-xmlrpc=shared' '--with-xsl=shared' '--enable-wddx=shared' '--enable-zip=shared' '--with-zlib=shared' '--without-db1' '--without-db2' '--without-db3' '--without-qdbm' '--with-mssql=shared' '--with-pdo-dblib=shared' '--enable-opcache' 'build_alias=x86_64-alpine-linux-musl' 'host_alias=x86_64-alpine-linux-musl' 'CC=gcc' 'CFLAGS=-Os -fomit-frame-pointer -g' 'LDFLAGS=-Wl,--as-needed' 'CPPFLAGS=-Os -fomit-frame-pointer' 'CXXFLAGS=-Os -fomit-frame-pointer -g'
/etc/php5/conf.d/odbc.ini,
/etc/php5/conf.d/pdo_odbc.ini,
odbc
ODBC_LIBS => -lodbc
odbc.allow_persistent => On => On
odbc.check_persistent => On => On
odbc.default_cursortype => Static cursor => Static cursor
odbc.default_db => no value => no value
odbc.default_pw => no value => no value
odbc.default_user => no value => no value
odbc.defaultbinmode => return as is => return as is
odbc.defaultlrl => return up to 4096 bytes => return up to 4096 bytes
odbc.max_links => Unlimited => Unlimited
odbc.max_persistent => Unlimited => Unlimited
PDO drivers => mysql, odbc, pgsql, sqlite
Я настроил свой файл odbcinst.ini.
[ODBC Drivers]
NetezzaSQL=Installed
UsageCount=1
[NetezzaSQL]
Driver=/nz/lib64/libnzodbc.so
Setup=/nz/lib64/libnzodbc.so
APILevel=1
ConnectFunctions=YYN
Description=Netezza ODBC driver
DriverODBCVer=03.51
DebugLogging=false
LogPath=/tmp
UnicodeTranslationOption=utf8
CharacterTranslationOption=all
PreFetch=256
Socket=16384
UsageCount=1
I have been configure also for odbc.ini file.
[ODBC Data Sources]
NZ09 = NetezzaSQL
[NZ09]
Driver = /nz/lib64/libnzodbc.so
Description = NetezzaSQL ODBC
Servername = 10.xx.xxx.x
Port = 5480
Database = TELKOMxxxxx
Username = xxxxx
Password = xxxxx
ReadOnly = false
ShowSystemTables = false
LegacySQLTables = false
LoginTimeout = 0
QueryTimeout = 0
DateFormat = 1
NumericAsChar = false
SQLBitOneZero = false
StripCRLF = false
caCertFile =
When i try to attemp a connection using isql i get this error.
sh-4.3# isql -v NZ09
[01000][unixODBC][Driver Manager]Can't open lib '/nz/lib64/libnzodbc.so' : file not found
[ISQL]ERROR: Could not SQLConnect
When i try to attemp a connection using my PHP Code i still get same error where the so file /nz/lib64/libnzodbc.so cannot be open.
sh-4.3# php coba.php
PHP Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Can't open lib '/nz/lib64/libnzodbc.so' : file not found, SQL state 01000 in SQLConnect in /coba.php on line 12
Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Can't open lib '/nz/lib64/libnzodbc.so' : file not found, SQL state 01000 in SQLConnect in /coba.php on line 12
PHP Warning: odbc_exec() expects parameter 1 to be resource, boolean given in /coba.php on line 16
Warning: odbc_exec() expects parameter 1 to be resource, boolean given in /coba.php on line 16
PHP Warning: odbc_fetch_row() expects parameter 1 to be resource, null given in /coba.php on line 18
Warning: odbc_fetch_row() expects parameter 1 to be resource, null given in /coba.php on line 18
PHP Warning: odbc_result() expects parameter 1 to be resource, null given in /coba.php on line 20
Warning: odbc_result() expects parameter 1 to be resource, null given in /coba.php on line 20
Test
PHP Warning: odbc_close() expects parameter 1 to be resource, boolean given in /coba.php on line 22
Warning: odbc_close() expects parameter 1 to be resource, boolean given in /coba.php on line 22
Почему это происходит ? когда я пытаюсь убедиться, что файл so работает хорошо, используя команду ldd, он работает хорошо, но когда я пытаюсь установить соединение, файл so не может быть открыт, почему это происходит ? любая помощь будет признательна заранее, спасибо.