on 2018 Feb 21 11:26 AM
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 :
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 :
So far, nothing works.
My question : how can i recuperate environment variables though a web page and not with php-cgi?
Thanks
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
User | Count |
---|---|
67 | |
11 | |
10 | |
10 | |
9 | |
8 | |
6 | |
6 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.