How to add pdo_odbc (unixODBC flavor) to raw opts? Static vs Shared build issue

human_web_dev

Registered
Oct 8, 2013
1
0
1
cPanel Access Level
Root Administrator
Hi Forum.
I've been trying to add pdo_odbc to my easy apache rawopts, but have not been able to compile php and apache successfully.
In my all_php5 file I've tried a few variations on this option:

--with-pdo-odbc=unixODBC
--with-pdo-odbc=unixODBC,/usr/local
--with-pdo-odbc=unixODBC,/usr/local,shared
--with-pdo-odbc=shared

...none of which work. It consistently fails at at the end of compilation with:

"You've configured extension pdo_odbc to build statically, but it
depends on extension pdo, which you've configured to build shared.
You either need to build pdo_odbc shared or build pdo statically for the
build to be successful."

It seems that the expected syntax of "--with-<extension>=shared|static" doesn't jive with php's recommendation for installing a given flavor of pdo_odbc like "--with-pdo-odbc=unixODBC,dir". How do I reconcile these differences? I've not once specified that I want pdo_odbc to build statically, but the presence of the "=unixODBC" seems to imply this.

More info on my environment:
php 5.4.20
apache 2.2
FreeTDS 0.91
unixODBC 2.3.1
hmm.. have I left out any pertinent details?

If anybody has a clue as to how set this option correctly, I'd sure like to know.
Many thanks in advance for any help you can provide.
-Jack
 

cPanelKeithS

Active Member
Staff member
Oct 14, 2008
32
1
133
I wanted to share the resolution I found in my test environment so that others may find this helpful.

-bash-4.1# yum -y install unixODBC unixODBC-devel

Add the configure flags to the rawopts file for php5. Declaring 'shared' first was necessary.

-bash-4.1# cat /var/cpanel/easy/apache/rawopts/all_php5
--with-pdo-odbc=shared,unixODBC,/usr

# /scripts/easyapache --build

If PDO is not already enabled, you will need to run easyapache without --build and select PDO through the menu.

-bash-4.1# php -i | grep -i odbc
Configure Command => './configure' '--disable-fileinfo' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-libxml' '--enable-pdo=shared' '--enable-sockets' '--prefix=/usr/local' '--with-apxs2=/usr/local/apache/bin/apxs' '--with-curl=/opt/curlssl/'
'--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-libxml-dir=/opt/xml2/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-openssl=/usr' '--with-openssl-dir=/usr'
'--with-pcre-regex=/opt/pcre' '--with-pdo-mysql=shared' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-sqlite=shared' '--with-pic' '--with-zlib' '--with-zlib-dir=/usr'
PDO drivers => sqlite, mysql, odbc
PDO_ODBC
PDO Driver for ODBC (unixODBC) => enabled
ODBC Connection Pooling => Enabled, strict matching

I did have to add the extension directive to the php.ini manually, as well

-bash-4.1# grep pdo_odbc /usr/local/lib/php.ini
extension=pdo_odbc.so