PHP | CouchbaseCluster not found


Docker volumes allow you to map your local directory into container, as simple as -v /local/dir:/container/dir. Read more at

I think it is just your local issue, and the steps in the guide still valid. I have just checked them on clean MacOS setup. It is just your system is misconfigured. And the docker allows you to maintain your development environment in reproducible way.

$ sw_vers 
ProductName:	Mac OS X
ProductVersion:	10.12.6
BuildVersion:	16G29

$ brew install libcouchbase
$ brew install homebrew/php/php70-couchbase

$ php --version
PHP 7.0.23 (cli) (built: Sep 25 2017 08:07:03) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies

$ php --ini
Configuration File (php.ini) Path: /usr/local/etc/php/7.0
Loaded Configuration File:         /usr/local/etc/php/7.0/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.0/conf.d
Additional .ini files parsed:      /usr/local/etc/php/7.0/conf.d/ext-couchbase.ini,

$ php -m | grep couchbase

$ php -r "var_dump(new \Couchbase\Cluster('couchbase://localhost'));"
object(Couchbase\Cluster)#1 (2) {
  string(21) "couchbase://localhost"

To test with apache (if you don’t want to use builtin webserver php -S localhost:8080 for development), you need mod_php which is not installed by default.

$ brew reinstall php70 --with-httpd24

Also because we have reinstalled php with apache module, the extension also have to be recompiled

$ brew reinstall -s homebrew/php/php70-igbinary homebrew/php/php70-couchbase

This will also install httpd from homebrew:

$ sudo httpd -V
Server version: Apache/2.4.27 (Unix)
Server built:   Sep 29 2017 16:26:08
Server's Module Magic Number: 20120211:68
Server loaded:  APR 1.6.2, APR-UTIL 1.6.0
Compiled using: APR 1.6.2, APR-UTIL 1.6.0
Architecture:   64-bit
Server MPM:     event
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D HTTPD_ROOT="/usr/local/Cellar/httpd/2.4.27_2"
 -D SUEXEC_BIN="/usr/local/Cellar/httpd/2.4.27_2/bin/suexec"
 -D DEFAULT_PIDLOG="/usr/local/var/run/httpd/"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/usr/local/etc/httpd/mime.types"
 -D SERVER_CONFIG_FILE="/usr/local/etc/httpd/httpd.conf"

Configure apache to apply handler from PHP7 module

cat <<EOF | sudo tee -a /usr/local/etc/httpd/httpd.conf
<FilesMatch .php$>
    SetHandler application/x-httpd-php

To check that apache loads PHP module, run

$ sudo httpd -M | grep php
php7_module (shared)

Create test file:

echo -e "<?php\nvar_dump(new \Couchbase\Cluster('couchbase://localhost'));" | sudo tee /usr/local/Cellar/httpd/2.4.27_2/share/httpd/htdocs/test.php

We didn’t include this into SDK setup steps, because these are basic steps for every machine, which is going to run apache with php module, and does not have any relation to Couchbase or its client SDK. I don’t see why our guide should also cover setup of PHP development machine from scratch, which are trivial and covered in other places.


Sorry avsej, we need a system-guy in our company. I am not an expert and I do the best I can. I will try again later this week.