Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in August and this forum will be retired.

Hi, i'm running SQLAnywhere, ( 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 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: -> /opt/sqlanywhere12/lib64/ in /etc/php.ini I have:

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

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

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

Any help will be greatly appreciated!

asked 05 Jul '12, 14:50

tomb's gravatar image

accept rate: 0%

edited 15 Mar '13, 19:48

Mark%20Culp's gravatar image

Mark Culp

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: 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:


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

permanent link

answered 10 Jul '12, 10:05

kaaposc's gravatar image

accept rate: 0%

Hi, that works! beauty!

Good solution, thanks a lot.

(10 Jul '12, 13:13) tomb

It's 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.


permanent link

answered 06 Jul '12, 07:16

kaaposc's gravatar image

accept rate: 0%

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

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

(06 Jul '12, 09:15) tomb

Yes, 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 in php.ini

(06 Jul '12, 09:29) kaaposc
Replies hidden

I've tried both things with no success. I've also noticed that if I add the 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.

(06 Jul '12, 13:53) tomb

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


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

(09 Jul '12, 10:52) tomb

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!

(09 Jul '12, 16:23) tomb
Replies hidden

'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).

(10 Jul '12, 11:33) Jeff Albion
showing 3 of 6 show all flat view

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

To my php-fpm.conf file.

permanent link

answered 11 May '13, 00:57

Bob%20Piskac's gravatar image

Bob Piskac
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 05 Jul '12, 14:50

question was seen: 17,224 times

last updated: 11 May '13, 00:57