cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

PHP Warning: PHP Startup: Unable to load dynamic library

Former Member
23,021

Hello,

I'm been trying to get PHP working with the sqlanywhere.so module and I get the following message. PHP Warning: PHP Startup: Unable to load dynamic library

PHP 5.2.17
Mac: O/S X : 10.6.6
Server version: Apache/2.2.15 (Unix)
Zend Server:

Sybase Version 7.0

In phpInfo(), it shows that my sqlanywhere.so extension is in the proper extension_dir, and the php.ini file shows that the extension is suppost to be loaded.

I've downloaded the latest module threaded version from the sybase website (ver 5.3.5) threaded and still doesn't work. In addition I've also tried to manually compile the extension and paste into my extension_dir, but get the same error.

Also my LD_LIBRARY_PATH is set in my env and does point to the library files, so when i run say ./dbsrv12 it works.

Please help this is very frustrating

View Entire Topic
Former Member

I was able to build and load the SQL Anywhere PHP driver on a Mac OS X 10.6.0 machine with the following commands:

curl http://download.sybase.com/ianywhere/php/2.0.10/sasql_php.zip -o sasql_php.zip
unzip -a sasql_php.zip
cd sqlanywhere
/usr/bin/phpize .
./configure
make
su
make install
echo "extension=sqlanywhere.so" >> /etc/php.ini
exit
/usr/bin/php --info | grep -i sqlanywhere

You will have to substitute /usr/bin with the location of your PHP installation (for both php and phpize). Also use the correct location of php.ini as can be found with /usr/bin/php --info | grep php.ini.

The last line should produce output similar to:

sqlanywhere
SQLAnywhere support => enabled
PHP SQLAnywhere driver version => 2.0.10.0
SQLAnywhere client version => 12.0.1.3152
sqlanywhere.allow_persistent => On => On
sqlanywhere.auto_commit => On => On
sqlanywhere.max_connections => Unlimited => Unlimited
sqlanywhere.max_persistent_connections => Unlimited => Unlimited
sqlanywhere.verbose_errors => On => On

If your DYLD_LIBRARY_PATH is not set correctly you will see the following value for SQLAnywhere client version (instead of 12.0.1.3152😞

SQLAnywhere client version => The SQLAnywhere client libraries could not be loaded. Please ensure that libdbcapi.so can be found in your LD_LIBRARY_PATH environment variable.

Admittedly, the specific details in that error message are incorrect for Mac OS X, but the idea is correct.

Once you have this working, it should be fairly easy to get it to work in Apache.

Former Member
0 Likes

I tried what you mentioned and am still getting the error PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/sqlanywhere.so' - (null) in Unknown on line 0

Does it matter the I'm using Zend Server?

Former Member
0 Likes

When do you get the error message? Is it when you run /usr/bin/php --info? Or is it when you start your Zend server?

Former Member
0 Likes

right after i follow what you wrote if i run 'make test', or after i restart apache then run "php -m", also when zend server starts and I check the log files.. it shows up there as well

Former Member
0 Likes

Is the file in /usr/local/zend/lib/php_extensions/sqlanywhere.so the same one you just built? Or is it an older one?

I've never used Zend. It may have PHP compiled in a different way (threaded vs non-threaded, or some other difference). PHP is exceptionally picky about differences in compiling. Make sure when you use phpize that you're using the one from the Zend installation (if there is one), otherwise there may be a difference.

You may also want to look at this forum post: http://forums.zend.com/viewtopic.php?f=59&t=2365&p=9981

Former Member
0 Likes

Yes it is the sqlanywhere.so that is being built, I validated by removing the file and watching to see if another gets copied into that ext directory once I run the above install, and it does. The phpize bin is the one included in the zend install /usr/local/Zend/bin, and when I run phpize i include the full path.

I checked the link and added the ARCHPREFERENCE to env.. still same result 😞

Former Member
0 Likes

Hmmm...then I'm stumped.

Former Member
0 Likes

very discouraging. if the expert is stumped what chance do i have..

Former Member
0 Likes

Can you try to make it work with regular PHP to rule out any issues specific to Zend server?

Former Member
0 Likes

I tried to install the latest zend server 5.3, and this error is the same but slightly different

Warning: PHP Startup: Unable to load dynamic library '/sqlanywhere/modules/sqlanywhere.so' - dlopen(/sqlanywhere/modules/sqlanywhere.so, 9): no suitable image found.

Did find: /sqlanywhere/modules/sqlanywhere.so: mach-o, but wrong architecture in Unknown on line 0

any idea on this?

Former Member
0 Likes

It still appears that your Zend server is a different architecture than the sqlanywhere.so module you've built. The output of the following two commands should be (almost) identical:

file /usr/local/zend/lib/php_extensions/sqlanywhere.so
file php

...make sure you give the full path to the PHP binary. If they differ, then that should indicate your problem.