cancel
Showing results for 
Search instead for 
Did you mean: 

SQLAnywhere client libraries won't load

Former Member
17,607

Hi, i'm running SQLAnywhere, (12.0.1.3723) on Fedora 16 (3.4.2-1.fc16.x86_64) and I can't connect with PHP in the browser. http://thesite/phpinfo.php gives me the following:

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

I have my usual config & setup on Fedora ... as shown here:

in directory /usr/lib64/php/modules i have the following: php-5.3.2_sqlanywhere.so -> /opt/sqlanywhere12/lib64/php-5.3.2_sqlanywhere.so in /etc/php.ini I have: extension=php-5.3.2_sqlanywhere.so

in /etc/sysconfig/httpd i have: source /opt/sqlanywhere12/bin64/sa_config.sh

If i run the same phpinfo.php from a shell, it works .. as shown here: SQLAnywhere client version => 12.0.1.3723

I can't figure out what I'm missing for apache to load the client libraries.

Any help will be greatly appreciated!

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member

Just finished Fedora16 install on virtual machine and did some digging around system configuration.

The file /etc/init.d/httpd (main apache service file) sources /etc/rc.d/init.d/functions (common useful functions for daemons and stuff). It tests if systemctl should be used and then redirects command (e.g. start) and service name (e.g. httpd) to systemctl binary. This binary somehow fails to correctly source /etc/sysconfig/httpd and thus does not have correct PATH and LD_LIBRARY_PATH (not sure why...)

My solution is to create a custom shell script file to 1) prepare SA12 environment and 2) to start httpd service. I pastebined it here: http://pastebin.com/iyS3XnY0 Put it in, let's say, /usr/sbin and chmod a+x it. Also you have to edit /lib/systemd/system/httpd.service file to point to this new custom starter file. Back up it and replace line ExecStart=... with this:

ExecStart=/usr/sbin/my-httpd

Restart httpd.service (via systemctl) and hopefully it should work now.

Former Member
0 Kudos

Hi, that works! beauty!

Good solution, thanks a lot.

Former Member
0 Kudos

I just added env[LD_LIBRARY_PATH] = /opt/sqlanywhere12/lib64

To my php-fpm.conf file.

Former Member
0 Kudos

It's php-5.3.2_sqlanywhere.so module complaining about not being able to find libraries.

$LD_LIBRARY_PATH (as visible to apache) should contain also sasql12 libraries directory. In /etc/sysconfig/httpd (I guess it's the right one in Fedora) add something like this:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/sqlanywhere12/lib64

Check after apache restart your phpinfo() for LD_LIBRARY_PATH in Environment section to be sure sqlanywhere library directory is included.

HTH

Former Member
0 Kudos

Hi, thanks for that. I didn't mention above that I have this line in my /etc/sysconfig/httpd file: source /opt/sqlanywhere12/bin64/sa_config.sh

I believe that does what you've mentioned here, and normally this works fine. I'm still at a complete loss right now.

Former Member
0 Kudos

Yes, sa_config.sh does this and a little more. It prepares environment.

As for your problem - check permissions. phpinfo.php in console runs from your user's environment, apache has it's own.

Also you can try to give a full path to php-5.3.2_sqlanywhere.so in php.ini

Former Member
0 Kudos

I've tried both things with no success. I've also noticed that if I add the php-5.3.2_sqlanywhere.so into the php.ini file, in any form, i get this message when i do a phpinfo.php at the command line: Module 'sqlanywhere' already loaded in Unknown on line 0

I don't know why or where its already loaded from, and it still doesn't work in the browser.

Former Member
0 Kudos

Hi, ok, i now have 2 machines running Fedora core 16, SQLAnywhere 12, and they both have the same problem as discussed here. I have another older machine running Fedora Core 12, SQLAnywhere 11, and it runs just fine. All machines have the same basic configuration as shown above. Is there a difference with the newer OS, or SQLAnywhere ?

here is the Environment for apache (phpinfo.php):

PATH: $SQLANY12/bin64:$SQLANY12/bin32:${PATH:-}

SQLANY12: /opt/sqlanywhere12

LD_LIBRARY_PATH: $SQLANY12/lib64:${LD_LIBRARY_PATH:-}

I currently have one client down, any help will be greatly appreciated!!

Former Member
0 Kudos

Hi, I have found a solution for this problem, but it is far beyond my pay scale. If I start apache with "systemctl start httpd.service", the client libraries do NOT load. If I start apache with "apachectl start" the client libraries load, and applications run fine.

This also seems to mean that the client libraries do NOT load at boot time, and therefore requires manual intervention.

Any explanation/help to configure this would be greatly appreciated!

jeff_albion
Product and Topic Expert
Product and Topic Expert
0 Kudos

'apachectl' handles environment variables differently for Apache - it additionally reads the Apache 'envvars' config file (see the discussion here).

How did you create the Apache service originally, or is this an RPM distribution? If you compiled from source, you can use 'chkconfig' to install the service. (See: here and here).