on ‎2011 Mar 21 2:31 PM
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
Request clarification before answering.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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 😞
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?
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.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.