ID: 26049
Updated by: [email]kalowskyphp.net[/email]
Reported By: miroslav dot sulc at startnet dot cz
-Status: Open
+Status: Bogus
Bug Type: ODBC related
Operating System: Linux (Gentoo)
PHP Version: 4.3.3
New Comment:

Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit [url]http://www.php.net/support.php[/url] as this bug system is not the
appropriate forum for asking support questions.

Thank you for your interest in PHP.

Please read how to configure your unixODBC system.


Previous Comments:
------------------------------------------------------------------------

[2003-10-31 05:00:28] miroslav dot sulc at startnet dot cz

Description:
------------
I cannot connect with:
$var=odbc_connect('myodbc-test','root','password');
to my MyODBC data source.

Here is the error:
Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Can't
open lib '/usr/lib/libmyodbc3.so' : unknown error, SQL state IM003 in
SQLConnect in /home/httpd/bagr/docs/test.php on line 2

I would appreciate any help. Below is some more info.

isql command work fine:
echo "show tables;
> " | isql myodbc-test root password
+---------------------------------------+
| Connected! |
| |
| sql-command |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
+-----------------------------------------------------------------+
| Tables_in_test |
+-----------------------------------------------------------------+
+-----------------------------------------------------------------+
0 rows affected


Here is PHP configuration:
'./configure' '--prefix=/usr' '--host=i686-pc-linux-gnu'
'--mandir=/usr/share/man' '--infodir=/usr/share/info'
'--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib'
'--without-readline' '--with-apxs2=/usr/sbin/apxs2' '--with-ndbm=/usr'
'--with-db4=/usr' '--with-mcrypt=/usr' '--with-mhash=/usr'
'--with-ming=/usr' '--with-swf=/usr' '--with-sybase=/usr'
'--with-gdbm=/usr' '--with-java=/opt/blackdown-jdk-1.4.1'
'--with-mcal=/usr' '--with-unixODBC=/usr' '--with-pgsql=/usr'
'--with-snmp=/usr' '--enable-ucd-snmp-hack' '--with-pdflib=/usr'
'--with-gd' '--enable-gd-native-ttf' '--with-png' '--with-png-dir=/usr'
'--with-jpeg' '--with-jpeg-dir=/usr' '--enable-exif' '--with-tiff'
'--with-tiff-dir=/usr' '--with-mysql=/usr'
'--with-mysql-sock=/var/run/mysqld/mysqld.sock'
'--with-freetype-dir=/usr' '--with-ttf=/usr' '--with-t1lib=/usr'
'--with-gettext' '--without-qtdom' '--with-pspell=/usr'
'--with-openssl=/usr' '--with-imap=/usr' '--with-ldap=/usr'
'--with-dom=/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr'
'--with-kerberos=/usr' '--with-pam' '--disable-memory-limit'
'--disable-ipv6' '--with-curlwrappers' '--with-curl=/usr'
'--enable-dbx' '--with-imap-ssl' '--with-zlib' '--with-zlib-dir=/usr'
'--with-sablot=/usr' '--enable-xslt' '--with-xslt-sablot'
'--with-xmlrpc' '--enable-wddx' '--with-xml' '--enable-mbstring=all'
'--enable-mbregex' '--with-bz2=/usr' '--with-crack=/usr' '--with-cdb'
'--enable-bcmath' '--enable-calendar' '--enable-dbase'
'--enable-filepro' '--enable-ftp' '--with-mime-magic'
'--enable-sockets' '--enable-sysvsem' '--enable-sysvshm'
'--enable-sysvipc' '--with-iconv' '--enable-shmop' '--enable-dio'
'--enable-inline-optimization' '--enable-track-vars'
'--enable-trans-sid' '--enable-versioning'
'--with-config-file-path=/etc/php/apache2-php4'

Here are versions:
unixODBC: 2.0.6
MyODBC: 3.51.06

/etc/unixODBC/odbc.ini:
[myodbc-test]
Description = MySQL ODBC myodbc-3.51.06 Driver Testing DSN
Driver = /usr/lib/libmyodbc3.so
Socket = /var/run/mysqld/mysqld.sock
Server = localhost
User = root
Database = test
Option = 3

/etc/unixODBC/odbcinst.ini:
[myodbc]
Description = MySQL ODBC Driver
Driver = /usr/lib/libmyodbc3.so
FileUsage = 1

File permissions:
ls -l /usr/lib/libmyodbc3*
-rwxr-xr-x 1 root root 157984 Oct 30 10:28
/usr/lib/libmyodbc3-3.51.06.so
-rw-r--r-- 1 root root 175340 Oct 30 10:28
/usr/lib/libmyodbc3.a
-rwxr-xr-x 1 root root 861 Oct 30 10:28
/usr/lib/libmyodbc3.la
lrwxrwxrwx 1 root root 21 Oct 30 10:28
/usr/lib/libmyodbc3.so -> libmyodbc3-3.51.06.so

Apache runs as user apache and group apache.

php.ini diff against unpacked php.ini-dist from src distribution.
diff /etc/php/apache2-php4/php.ini php-4.3.3/php.ini-dist
428c428
< extension_dir = /usr/lib/php/extensions/no-debug-non-zts-20020429
---
> extension_dir = "./"
490,492c490
< ; allow_url_fopen = On
< ; Closed for security - <robbat2gentoo.org>
< allow_url_fopen = Off
---
> allow_url_fopen = On
530c528
< ; extension_dir = /usr/lib/php/extensions/no-debug-non-zts-20020429
---
> ; extension_dir directive above.
556c554
< extension = java.so
---
> ;extension=php_java.dll
603c601
< java.class.path =
/usr/lib/php/extensions/no-debug-non-zts-20020429/php_java.jar
---
> ;java.class.path = .\php_java.jar
605,606c603,604
< java.library = /opt/blackdown-jdk-1.4.1/jre/lib/i386/libjava.so
< java.library.path =
/usr/lib/php/extensions/no-debug-non-zts-20020429
---
> ;java.library = c:\jdk\jre\bin\hotspot\jvm.dll
> ;java.library.path = .\
I hope it's enough.

Reproduce code:
---------------
$var=odbc_connect('myodbc-test','root','password');

Expected result:
----------------
Should connect without errors :-)

Actual result:
--------------
Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Can't
open lib '/usr/lib/libmyodbc3.so' : unknown error, SQL state IM003 in
SQLConnect in /home/httpd/bagr/docs/test.php on line 2



------------------------------------------------------------------------


--
Edit this bug report at [url]http://bugs.php.net/?id=26049&edit=1[/url]