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

Where I work we have recently switched to SAP SQL Anywhere. We are currently trying to connect to our Sybase IQ server through a PHP webpage. We have installed the correct php extension and phpinfo() confirms it. We have also installed the sqlanywhere 16 client on the server. Then it starts to get troublesome. The php extension looks for the environment variable LD_LIBRARY_PATH but this variable is not set for the user. So we are trying to set this variable for this user but with no success so far ...

Here is some info about the environment :

  • OS : Debian 8.10 Jessie
  • Web hosting plateform : Plesk
  • PHP : 7.1.8

Executing scripts that use the environments variables work fine if I execute with PHP-CGI, but if I execute the script though the web page, I can't recuperate the environment variables.

The user is different when accessing the script through a web page but i can't load the environment variables for the page.

So far, i've tried setting the environment variables in :

  • /etc/environment
  • .bashrc of the user
  • .htaccess
  • apache2ctl
  • PHP commande "putenv"
  • ld.so.conf.d

So far, nothing works.

My question : how can i recuperate environment variables though a web page and not with php-cgi?

Thanks

asked 21 Feb '18, 11:26

pwd-claudio's gravatar image

pwd-claudio
11113
accept rate: 50%


Ok after 3 weeks of trial and error i have found the solution for my case.

Here are the steps i had to take to make it work:

Change from PHP fastCGI to FPM served by apache Add the following code to /opt/php7.1/etc/php-fpm.d/mydomaine.conf [php-fpm-pool-settings] env[LD_LIBRARY_PATH]="/var/www/vhosts/localhost.localdomain/httpdocs/sqlanywhere16/lib64:/var/www/vhosts/localhost.localdomain/httpdocs/sqlanywhere16/lib32"

Execute the commands : ldconfig -v

ldconfig -p

Restart the server

permanent link

answered 02 Mar '18, 02:30

pwd-claudio's gravatar image

pwd-claudio
11113
accept rate: 50%

The common cause for this problem is that the LD_LIBRARY_PATH environment variable has not been set prior to starting your apache server. I.e. in the script that starts your httpd (apache) server, ensure that you source sa_config.sh prior to starting httpd.

More information on how to install/configure PHP for SQL Anywhere can be found here. In particular, read and ensure you have done step 8 on this list.

There are also several questions (and answers) related to this topic on this forum - just search for "apache" that may be helpful.

HTH

permanent link

answered 21 Feb '18, 11:59

Mark%20Culp's gravatar image

Mark Culp
24.9k10141297
accept rate: 41%

edited 21 Feb '18, 12:01

Hello,

Thanks for your answer. Unfortunately I have read many times the documentation on how to install/configure PHP for SQL Anywhere but with no success.

I understand where the problem lies but I don't know how to resolve it. From what I have discovered, Apache in plesk does not load the envvars file properly. Because I have set this file to execute the sh sa_config.sh.

If I source the envvars file, I will have the variables I am looking for but if I try to get them through a webpage they won't be available.

We have been stuck in with this for over 2 weeks.

Thanks for your assistance.

(22 Feb '18, 09:29) pwd-claudio
Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×70

question asked: 21 Feb '18, 11:26

question was seen: 3,162 times

last updated: 02 Mar '18, 02:30