Topic: php-odbc : Can't open cursor lib 'libodbccr'

[unixODBC][Driver Manager]Can't open cursor lib 'libodbccr' : file not found'

<?php

$cnx = new PDO("odbc:DRIVER=FreeTDS;SERVER=localhost,49503;DATABASE=DB;MARS_Connection=yes;", 'ereporting', 'CqPkYMLiUU5NBfPwnMFk');

Or tout fonctionne correctement sans passer par PHP (tsql et isql me permettent de me connecter).

Je pense que tu n'a pas buildé PHP ODBC avec la bonne version d'unixODBC.


En analysant un peu plus :

$ locate libodbccr
/usr/lib64/libodbccr.so.2
/usr/lib64/libodbccr.so.2.0.0
$ rpm -qf /usr/lib64/libodbccr.so.2
unixODBC-2.2.14-12.el6_3.x86_64
$ yum info unixODBC-2.2.14-12.el6_3.x86_64
Installed Packages
Name        : unixODBC
Arch        : x86_64
Version     : 2.2.14
Release     : 12.el6_3
Repo        : installed
From repo   : base
$ strace php monscript.php
...
access("/lib64/libodbccr.so.1", R_OK)   = -1 ENOENT (No such file or directory)
access("/usr/lib64/libodbccr.so.1", R_OK) = -1 ENOENT (No such file or directory)
access("/lib/libodbccr.so.1", R_OK)     = -1 ENOENT (No such file or directory)
access("/usr/lib/libodbccr.so.1", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 5
fstat(5, {st_mode=S_IFREG|0644, st_size=29142, ...}) = 0
mmap(NULL, 29142, PROT_READ, MAP_PRIVATE, 5, 0) = 0x7fbdc5755000
close(5)                                = 0
open("/lib64/tls/x86_64/libodbccr.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib64/tls/x86_64", 0x7fff64b5ff90) = -1 ENOENT (No such file or directory)
open("/lib64/tls/libodbccr.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib64/tls", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0
open("/lib64/x86_64/libodbccr.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib64/x86_64", 0x7fff64b5ff90)   = -1 ENOENT (No such file or directory)
open("/lib64/libodbccr.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib64", {st_mode=S_IFDIR|0555, st_size=12288, ...}) = 0
open("/usr/lib64/tls/x86_64/libodbccr.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/tls/x86_64", 0x7fff64b5ff90) = -1 ENOENT (No such file or directory)
open("/usr/lib64/tls/libodbccr.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/tls", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0
open("/usr/lib64/x86_64/libodbccr.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/x86_64", 0x7fff64b5ff90) = -1 ENOENT (No such file or directory)
open("/usr/lib64/libodbccr.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib64", {st_mode=S_IFDIR|0555, st_size=20480, ...}) = 0
munmap(0x7fbdc5755000, 29142)           = 0
open("/usr/lib64/libodbccr.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
close(4)                                = 0
brk(0x18d7000)                          = 0x18d7000

Si on cherche qui fournit libodbccr.so.1 on ne trouve qu'un paquet Centos 5.x :
http://rpmfind.net/linux/rpm2html/searc … rch=x86_64

Re: php-odbc : Can't open cursor lib 'libodbccr'

> Je pense que tu n'a pas buildé PHP ODBC avec la bonne version d'unixODBC.
J'ai construit PHP avec la version présente dans les dépôts officiels de RHEL-6.5.

Est-ce que freetds est installé ?
Que contient la config du pilote "FreeTDS" ?

Je n'ai pas de base MSSQL pour faire de test.

Desktop: Fedora 31 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 32 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: php-odbc : Can't open cursor lib 'libodbccr'

Dans le code source de unixODBC, on trouve

./unixODBC-2.2.14/DriverManager/SQLConnect.c:#define CURSOR_LIB      "libodbccr"
./unixODBC-2.2.14/DriverManager/SQLConnect.c:#define CURSOR_LIB_VER  ".1"

Je pense que le soucis viens de là...

Desktop: Fedora 31 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 32 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: php-odbc : Can't open cursor lib 'libodbccr'

Remi wrote:

Est-ce que freetds est installé ?
Que contient la config du pilote "FreeTDS" ?

Je n'ai pas de base MSSQL pour faire de test.

Mon pilote :

[FreeTDS]
Description = ODBC for MsSQL
Driver      = /usr/lib64/libtdsodbc.so.0
Setup       = /usr/lib64/libtdsS.so.2
FileUsage   = 1

Pour FreeTDS oui il est installé, c'est la version d'EPEL :

$ yum info freetds
Installed Packages
Name        : freetds
Arch        : x86_64
Version     : 0.91
Release     : 2.el6
Size        : 2.6 M
Repo        : installed
Summary     : Implementation of the TDS (Tabular DataStream) protocol

Re: php-odbc : Can't open cursor lib 'libodbccr'

Peux-tu tester avec le build de test d'unixODBC dispo dans Remi repository temporary upload space ?

Desktop: Fedora 31 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 32 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: php-odbc : Can't open cursor lib 'libodbccr'

Remi wrote:

Dans le code source de unixODBC, on trouve

./unixODBC-2.2.14/DriverManager/SQLConnect.c:#define CURSOR_LIB      "libodbccr"
./unixODBC-2.2.14/DriverManager/SQLConnect.c:#define CURSOR_LIB_VER  ".1"

Je pense que le soucis viens de là...

En regardant le srpm :
http://vault.centos.org/6.5/os/Source/S … _3.src.rpm

Il applique un patch so-version-bump.patch

-LIB_VERSION="1:0:0"
+LIB_VERSION="2:0:0"

Re: php-odbc : Can't open cursor lib 'libodbccr'

oui, oui, c'est le pbm, mon rpm de test devrait corriger cela.

Desktop: Fedora 31 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 32 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

8 (edited by jeanseb 2014-01-31 13:49:39)

Re: php-odbc : Can't open cursor lib 'libodbccr'

C'est bon.

Sauf que ca segfault quand je fetch les résultats... Mais je crois que c'est un problème connu de ce driver...

Re: php-odbc : Can't open cursor lib 'libodbccr'

ok, merci pour le retour, je vais essayer de remonter le bug chez RH.

A suivre sur https://bugzilla.redhat.com/1060225

Desktop: Fedora 31 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 32 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: php-odbc : Can't open cursor lib 'libodbccr'

Pour info j'ai trouvé un autre souci https://bugs.php.net/bug.php?id=66633