OS : Ubuntu server 20.04.3 LTS Nginx version: nginx/1.18.0 (Ubuntu) PHP version: PHP 7.4.3 SQL Anywhere : SQL Anywhere 17 (client)

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 configured the php extension. i have installed sqlanywhere 17 client. i have set the environment. the error still appears.

https://drive.google.com/file/d/1BPuSUaaIBlLoNcJmUT3Y3IKpmR1VLDAb/view https://drive.google.com/file/d/1eWuD2enOhGHijOOfq84ePUMACTpvfQZ3/view https://drive.google.com/file/d/1FdDGX3geVllbFPyMrqLAI9Jkt3AFvT6X/view

asked 23 Nov '21, 00:58

armedfendy's gravatar image

armedfendy
11113
accept rate: 0%

For security reasons, the links will not be opened. What are they intending to show?

In any event, please source the sa_config.sh (or equivalent) that is in the bin64 (or bin32) and retest. You will likely need to set the SQLANY17 environment variable.

(23 Nov '21, 08:20) Chris Keating

thankyou for the response. I run sa_config.sh and no error occurs.

===========================================================

root@xxxx:~# source "/opt/sqlanywhere17/bin64/sa_config.sh"

root@xxxx:~#

===========================================================

I see environment variables.

===========================================================

root@xxxx:~# env

SHELL=/bin/bash SQLANYSAMP17=/opt/sqlanywhere17/samples PWD=/root LOGNAME=root XDG_SESSION_TYPE=tty MOTD_SHOWN=pam HOME=/root LANG=en_US.UTF-8 LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.zst=01;31:.tzst=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.wim=01;31:.swm=01;31:.dwm=01;31:.esd=01;31:.jpg=01;35:.jpeg=01;35:.mjpg=01;35:.mjpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.m4a=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.oga=00;36:.opus=00;36:.spx=00;36:*.xspf=00;36: SSH_CONNECTION=192.168.1.136 57044 192.168.1.17 24 SQLANY17=/opt/sqlanywhere17 LESSCLOSE=/usr/bin/lesspipe %s %s XDG_SESSION_CLASS=user TERM=xterm LESSOPEN=| /usr/bin/lesspipe %s USER=root SHLVL=1 XDG_SESSION_ID=3 LD_LIBRARY_PATH=/opt/sqlanywhere17/lib64:/opt/sqlanywhere17/lib32 XDG_RUNTIME_DIR=/run/user/0 NODE_PATH=/opt/sqlanywhere17/node SSH_CLIENT=10.128.16.136 57044 22 XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop PATH=/opt/sqlanywhere17/bin64:/opt/sqlanywhere17/bin32:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus SSH_TTY=/dev/pts/0 _=/usr/bin/env

root@xxxx:~#

===========================================================

I also see environment variables in phpinfo.php

===========================================================

https://drive.google.com/file/d/1BPuSUaaIBlLoNcJmUT3Y3IKpmR1VLDAb/view

https://drive.google.com/file/d/1eWuD2enOhGHijOOfq84ePUMACTpvfQZ3/view

https://drive.google.com/file/d/1FdDGX3geVllbFPyMrqLAI9Jkt3AFvT6X/view

===========================================================

i am trying to connect to sqlanywhere. the error remains the same.

===========================================================

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

===========================================================

(23 Nov '21, 19:55) armedfendy

Are those environment changes visible to PHP? For example, does phpinfo() confirm that the library path includes the SQL Anywhere directories? Did you restart the web server (assuming that is being used for testing) to pick up the changes? Have you tried setting either the webserver or PHP configuration files to source the SQLA environment?

permanent link

answered 24 Nov '21, 09:56

Chris%20Keating's gravatar image

Chris Keating
7.8k49128
accept rate: 32%

Solve

I set Environment to /etc/bash.bashrc (add code below)

#SQLANY17="/opt/sqlanywhere17"
#export SQLANY17
#[ -r "$HOME/.sqlanywhere17/sample_env64.sh" ] && . "$HOME/.sqlanywhere17/sample>
#[ -z "${SQLANYSAMP17:-}" ] && SQLANYSAMP17="/opt/sqlanywhere17/samples"
#export SQLANYSAMP17
#PATH="$SQLANY17/bin64:$SQLANY17/bin32:${PATH:-}"
#export PATH
#NODE_PATH="$SQLANY17/node:${NODE_PATH:-}"
#export NODE_PATH
#LD_LIBRARY_PATH="$SQLANY17/lib32:${LD_LIBRARY_PATH:-}"
#LD_LIBRARY_PATH="$SQLANY17/lib64:${LD_LIBRARY_PATH:-}"
#export LD_LIBRARY_PATH

i copy all file in /opt/sqlanywhere17/lib64 to /usr/lib/x86_64-linux-gnu

i copy all file in /opt/sqlanywhere17/bib64 to /usr/bin

i edit /etc/php/7.4/fpm/pool.d/www.conf (add code below)

#clear_env = no

#env[SQLANYSAMP17] = /opt/sqlanywhere17/samples
#env[SQLANY17] = /opt/sqlanywhere17
#env[PATH] = /opt/sqlanywhere17/bin64:/opt/sqlanywhere17/bin32:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
#env[LD_LIBRARY_PATH] = /opt/sqlanywhere17/lib64:/opt/sqlanywhere17/lib32
#env[NODE_PATH] = /opt/sqlanywhere17/node
permanent link

answered 25 Nov '21, 01:19

armedfendy's gravatar image

armedfendy
11113
accept rate: 0%

edited 25 Nov '21, 04:19

Volker%20Barth's gravatar image

Volker Barth
40.1k361549819

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
×18

question asked: 23 Nov '21, 00:58

question was seen: 1,362 times

last updated: 25 Nov '21, 04:19