cancel
Showing results for 
Search instead for 
Did you mean: 

MAMP, PHP module and LD_LIBRARY_PATH error on OS X

Former Member
5,107

Hello everybody! Today I'm trying to install php module of SQL Anywhere on MAMP for Mac OS X. I'm currently on Mac OS X 10.10 Yosemite, MAMP 3.0.7.1, php 5.5.17 and SQLAnywhere 16 Developer Edition. As guide I have followed Phil Mitchell post on this thread, but instead of download the module 2.0.10, I used version 2.0.12. For phpize and php instructions I have used the path of MAMP: /Applications/MAMP/bin/php/php5.5.17/. The output of my

/Applications/MAMP/bin/php/php5.5.17/bin/php --info | grep -i sqlanywhere

is:

sqlanywhere
SQLAnywhere support => enabled
PHP SQLAnywhere driver version => 2.0.12.0
SQLAnywhere client version => The SQLAnywhere client libraries could not be loaded. Please ensure that libdbcapi.so can be found in your LD_LIBRARY_PATH environment variable.
sqlanywhere.allow_persistent => On => On
sqlanywhere.auto_commit => On => On
sqlanywhere.max_connections => Unlimited => Unlimited
sqlanywhere.max_persistent_connections => Unlimited => Unlimited
sqlanywhere.verbose_errors => On => On


So in Terminal app with

nano /Applications/MAMP/Library/bin/envvars_

I changed the environment variables of Apache in this manner:

if test "x$DYLD_LIBRARY_PATH" != "x" ; then
  DYLD_LIBRARY_PATH="/Applications/SQLAnywhere16/System/lib64:/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
else
  DYLD_LIBRARY_PATH="/Applications/SQLAnywhere16/System/lib64:/Applications/MAMP/Library/lib"
fi
export DYLD_LIBRARY_PATH


Then, to be sure, I reboot my Mac. Once rebooted I restarted MAMP but phpinfo shows always

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

Someone can help me please? I need this module at work! In another Mac I've already set up the php module but there the module is installed on the Apache built in with Snow Leopard Server and when I changed "/System/Library/LaunchDaemons/org.apache.httpd.plist" as decribed in another post (written always by Phil Mitchell in this thread) evreything works fine. Thank you all guys! I appreciate any help possible!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Finally now it works! Thanks to this post on Stack Overflow I understand the problem...MAMP don't start Apache if exist envvars file since Mac OS X Yosemite Beta 5, so the developers have changed its name from "envvars" to "envvars_" to disable it. For now the only method to activate SQL Anywhere php module in Mac OS X Yosemite and MAMP, once compiled as described in my precedent post, is to modify "apachectl" file in this manner:

# pick up any necessary environment variables
if test -f /Applications/MAMP/Library/bin/envvars; then
  . /Applications/MAMP/Library/bin/envvars
else
. "/Applications/SQLAnywhere16/System/bin64/sa_config.sh"
fi


Thank you guys, to next issue!

Answers (1)

Answers (1)

0 Kudos

Hi, I'm trying to do the same, but with SQLAnywhere 17 on High Sierra. And I'm using a non-MAMP apache (one installed with brew). Similar issues. I get the impression that the error message "The SQLAnywhere client libraries could not be loaded. Please ensure that libdbcapi.so can be found in your LD_LIBRARY_PATH environment variable." is slightly misleading in that it's really looking for libdbcapi.dylib

Here's my apachectl script config section. The output of printenv confirms that DYLD_LIBRARY_PATH=/Applications/SQLAnywhere17/System/lib64:/Applications/SQLAnywhere17/System/lib32:

But I still get the error shown in phpinfo....

# |||||||||||||||||||| START CONFIGURATION SECTION  ||||||||||||||||||||
# --------------------                              --------------------
# 
# the path to your httpd binary, including options if necessary
HTTPD='/usr/local/opt/httpd/bin/httpd'
#
# pick up any necessary environment variables
if test -f /usr/local/opt/httpd/bin/envvars; then
  . /usr/local/opt/httpd/bin/envvars
else
. "/Applications/SQLAnywhere17/System/bin64/sa_config.sh"
fi
printenv
#
# a command that outputs a formatted text version of the HTML at the
# url given on the command line.  Designed for lynx, however other
# programs may work.  
LYNX="lynx -dump"
#
# the URL to your server's mod_status status page.  If you do not
# have one, then status and fullstatus will not work.
STATUSURL="http://localhost:8080/server-status"
#
# Set this variable to a command that increases the maximum
# number of file descriptors allowed per child process. This is
# critical for configurations that use many file descriptors,
# such as mass vhosting, or a multithreaded server.
ULIMIT_MAX_FILES=""
# --------------------                              --------------------
# ||||||||||||||||||||   END CONFIGURATION SECTION  ||||||||||||||||||||