Can't install PHP SDK, problem with libcouchbase

Hi there.
I’m trying to install the PHP SDK on my mac.
But I always get the following error:

checking for libcouchbase... not found
configure: error: Please reinstall the libcouchbase distribution -
                 libcouchbase.h should be <libcouchbase-dir>/include and
                 libcouchbase.a should be in <libcouchbase-dir>/lib
ERROR: `/private/tmp/pear/temp/couchbase/configure --with-php-config=/opt/homebrew/opt/php@7.4/bin/php-config' failed

I installed libcouchbase via Homebrew, then I tried running: pecl install couchbase and got that error.

Any ideas?
Thanks in advance

Hello @beitomartinez sorry for the delay, were you able to figure this out ?

Today I tried it on macOs and had not complaints. I tried installing the latest of PHP and libcouchbase and had no complaints. Are you trying to do the same ?

Hi!
A colleague helped me solved it.
It was an issue with the M1 processor. I had to run my terminal on rosetta2 and reinstall everything (brew, php) in order for it to work.

Thanks!

@AV25242 Is there a way to get this working without rosetta2?

configure: error: Please reinstall the libcouchbase distribution -
libcouchbase.h should be /include and
libcouchbase.a should be in /lib

I tried setting the CPPFLAGS and LDFLAGS but no luck yet.

I managed to install the couchbase php sdk on M1 Silicon by compiling from source the lib and change the libcouchbase lookup.

On M1 Homebrew is located in /opt/homebrew instead of /usr/local and the sdk installer does not look in /opt/homebrew.

I have no experience with compiling libs but this is what I did and it worked for me.

git clone GitHub - couchbase/php-couchbase: Couchbase PHP Client Library (Official)
cd php-couchbase

Edit config.m4 file and go to line 29.
This code block should follow:

dnl fallback on standard directory
else
for i in /usr/local /usr; do
if test -r $i/include/libcouchbase/couchbase.h; then
LIBCOUCHBASE_DIR=$i
AC_MSG_RESULT(found in $i)
fi
done
fi

I changed the ‘for i in /usr/local /usr; do’ in ‘for i in /opt/homebrew; do’

Then I followed the instructions from github to build from sources:

phpize
./configure --with-couchbase
make && make install

Hope this helps.

I had to do this when I got my MacBook Air a few months ago and again now trying to install it on a new MacBook Pro.

Maybe the installer should be updated to look also in /opt/homebrew?
Or maybe there is a better way to tell the installer where to look?

In the config.m4 file there is also a check for $PHP_COUCHBASE directory but I have no idea how to set it - or if it can be set in terminal before running pecl install couchbase etc to avoid building from source.