Php pdo_dblib - cannot find/unable to load freetds

Self-hosted box,
RHEL 6
PHP 5.3.3

PDO installed
freetds installed
pdo_dblib - so far no luck installing

My goal is to use PDO with sybase. Attempting to install pdo_dblib from the appropriate version php source code. I have tried a variety of methods and searched quite a bit for help on this topic, but have yet to be successful.

Method 1

Install freetds

$ ./configure
$ make
$ su root
Password: 
$ make install

This is successful

Install pdo_dblib

inside the /ext/pdo_dblib folder:

$ phpize
$ ./configure
$ make
$ make test

Error output:

PHP Warning:  PHP Startup: Unable to load dynamic library '/home/sybase/Install_items/php_533_src/php-5.3.3/ext/pdo_dblib/modules/pdo_dblib.so' - /home/sybase/Install_items/php_533_src/php-5.3.3/ext/pdo_dblib/modules/pdo_dblib.so: undefined symbol: php_pdo_register_driver in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/home/sybase/Install_items/php_533_src/php-5.3.3/ext/pdo_dblib/modules/pdo_dblib.so' - /home/sybase/Install_items/php_533_src/php-5.3.3/ext/pdo_dblib/modules/pdo_dblib.so: undefined symbol: php_pdo_register_driver in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/home/sybase/Install_items/php_533_src/php-5.3.3/ext/pdo_dblib/modules/pdo_dblib.so' - /home/sybase/Install_items/php_533_src/php-5.3.3/ext/pdo_dblib/modules/pdo_dblib.so: undefined symbol: php_pdo_register_driver in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/home/sybase/Install_items/php_533_src/php-5.3.3/ext/pdo_dblib/modules/pdo_dblib.so' - /home/sybase/Install_items/php_533_src/php-5.3.3/ext/pdo_dblib/modules/pdo_dblib.so: undefined symbol: php_pdo_register_driver in Unknown on line 0

That doesn't look good...I researched this and found an interesting hack for this here. But changing pdo.ini to pdo_0.ini was not the solution, as I still got the same errors on make test.

$ su
$ make install

Output:

Installing shared extensions:     /usr/lib64/php/modules/

That seems strange...and no, it doesn't actually install (not showing up on phpinfo after apache restart).

Method 2

Install freetds

following the instructions exactly, i add the prefix

$ ./configure --prefix=/usr/local/freetds
$ make
$ su root
Password: 
$ make install

This is successful

Install pdo_dblib

inside the /ext/pdo_dblib folder:

$ phpize
$ ./configure --with-sybase=/usr/local/freetds

This produces the following error at the bottom of the output

...
checking for PDO_DBLIB support via FreeTDS... yes, shared
configure: error: Cannot find FreeTDS in known installation directories

Method 3

freetds ./configure variation (including or not include the --prefix...) did not change the result of this so I'll skip it.

Install pdo_dblib pecl extension

following the method specified here.

pecl download pdo_dblib
tar -xzvf PDO_DBLIB-1.0.tgz

Removed the line,

<dep type=”ext” rel=”ge” version=”1.0″>pdo</dep>

Saved the package.xml file, and moved it in to the PDO_DBLIB directory.

mv package.xml ./PDO_DBLIB-1.0

Navigated to the PDO_DBLIB directory, then installed the package from the directory.

cd ./PDO_DBLIB-1.0
pecl install package.xml

But, this command gives me the following error output, same as Method 2.

checking for PDO_DBLIB support via FreeTDS... yes, shared
configure: error: Cannot find FreeTDS in known installation directories
ERROR: `/home/sybase/Install_items/pecl_pdo_dblib/PDO_DBLIB-1.0/configure' failed

After method 1, check your ini files and be sure that the pdo.so and pdo_dblib.so files are configured to be loaded. You can do this from the command line with a php -i and look for the "Loaded Configuration File" as well as "Additional .ini files parsed".

Among those files, ensure that extendion=pdo.so is loaded (possibly/probably before your pdo_dblib.so is loaded). If you want to maintain separate .ini files you can control the load order by how a straight ls -al orders the files.


Go back to method one and rebuild freetds with

./configure --enable-msdblib

and possibly

--enable-sybase-compat

If it still fails, post the output of ldd against any .so that fails to load.