A New World

We are releasing Couchbase Server 1.8 today and with it a complete rewrite of our PHP SDK. This is all good news: We beefed up the internals significantly while keeping the API compatible with previous releases. Yay!

Et tu Moxi?

Earlier versions of the PHP SDK relied on a small proxy server “moxi” between PHP and Couchbase (née Membase) Server. The SDK was only cabable of talking to a single endpoint. Moxi would take care of talking to your Couchbase Server Cluster and abstract away the tracking of nodes that come and go natuarally in such a setup. While that is all good, moxi came with additional administration overhead and a performance penalty.

With today’s release 1.0 of our PHP SDK we give you a PHP library that is cluster aware by itself. You don’t need to manage a separate moxi installation anymore. Furthermore, you don’t need to worry about changes to your Couchbase cluster. Whether new nodes arrive or old news are retired, your PHP code will always be able to talk to the cluster. And best of all, you get raw access to the cluster for maximum speed. Initial benchmarks show 1.5x-2.0x improvement on throughput.

Alright, Alright, Let Me Play!

The new SDK Overview page gives you all details from downloads to getting started guides as well as API documentation and an extensive tutorial to get you going.

Because this is all new code and we want to play fair we are calling this a 1.0.0-beta release, but we are ready to call it final as soon as we get a bunch fo successful user stories and no bug reports.

A Look Ahead

The new foundations for the PHP library allow us to give you more features faster. With Couchbase Server 2.0 around the corner, we can give you access to all its new features right away.

Author

Posted by Jan Lehnardt

Mr. Lehnardt co-founded Couchbase Inc. in 2009. He was Director of CouchOne Inc. He has been involved with CouchDB since 2006 as a developer, consultant and evangelist.

8 Comments

  1. So, do you only have to connect to any ONE server and the php library will figure out all the servers in the cluster? With the php memcache library I had to specify every server and it would use consistent hashing to figure out where to put things.

    1. Hey Brian, good catch really, while the extension is able to discover the whole cluster topology from one end-point, we are still adding the ability to specify multiple endpoints for the case when the specified node is out and the rest of the topology can\’t be discovered.

  2. Is there an indication on if and when a windows version of the library will be available?

  3. Still no update on a plan for a windows version of the library?

  4. Matt Ingenthron May 17, 2012 at 3:30 pm

    Hi Keith/Danny,

    I have a built version of the library here for testing.  Please send matt at couchbase an email and I\’ll send it back to you.

    Once tested, it\’ll be posted to the site along with docs, etc.

    Thanks!

  5.  Didn\’t see any good documentation on this at all –

    Long story short, I got couchbase working on PHP 5.4 atop IIS 7 on a x86 (win32) computer
    running win7.  Took me a couple days so hopefully someone will find this documentation
    useful and will save them time.

    Basically download the AWS version of PHP (precompiled) from (3), because of (2)
      (it includes the memcache extension in it)

    modified the PHP.ini for timezone, and extension directory
    added the extension=php_couchbase.dll to the php.ini

      (if you need to setup IIS and PHP see something like (6))

    download the php_couchbase.dll from (5),
    extrac for the 5.4 version, TS and put in the ext dir
    (I put php in c:php and the php_couchbase.dll in c:phpext)

    I kept getting all kinds of errors while logging about the dll not being found,
    so I ran procmon from sysinternals.com, (also depends.exe to see which dll\’s php_couchbase.dll required)

    found that php.exe was looking in the *local* directory for the libvbucket.dll and libcouchbase.dll
    and the ext dir for the module.  (I guess this makes sense but for a guy just wanting to test it was a surprise)
    after putting both those dll\’s in the c:php directory everything loaded fine.

    More details:

    Tried getting the php version working (1) working but it failed as it required memcache.
    Found (2) on stackoverflow, which said that you could get memcache on php 5.4 (win32)
    by downloading the AWS version (which has it prebuilt in) see (3).

    Found that the PHP-couchbase would still not run properly.
    Tried to build necessary dll for php by following: (4)
    but figured out it was only for the dlls (not including php module),
    but did allow me to build the libcouchbase.dll and libvbucket.dll
    necessary later which is also available here (5).

    After 500 errors in IIS and not found errors, I decided to just monitor the process and
    check the dll for dependencies – incorrect file placement was my cause and it
    resolved with putting the php_couchbase.dll in the ext dir and dependency dll\’s in the
    directory where php.exe was located.

    1: https://github.com/couchbasela
    2: http://stackoverflow.com/quest
    3: http://stalk.s3-website-eu-wes
    4: http://www.couchbase.com/libc
    5: http://downloads.php.net/pierr… (see the php_couchbase* zips they include the dlls)
    6: http://learn.iis.net/page.aspx

  6. I can get it working fine on Windows 7 x64, but not on Server 2008 x64 – server responds that the key does not exist, no matter what.

  7. […] updates in both the Java and Ruby SDKs.  Our own Jan Lehnardt also gives a quick rundown on the PHP SDK.  PHP and Ruby get their smarts from the brand new C (a.k.a. libcouchbase) SDK.  It’s new […]

Leave a reply