Iâm sorry, this will be a long rant, but you may learn that things are not as easy as experts expect.
Of course, I included the extension php_couchbase.dll in my php.ini via boilerplate.
[couchbase]
; Load the required extension (please note that this path needs to be
; absolute if the module isnât installed in the default search path
; for extensions (specified as extension_dir)).
;extension=couchbase.so
extension=php_couchbase.dll
; and some more
Actually I had to experiment a lot until I finally found the right (?) version â Apache simply wouldnât start as a service otherwise, as far as I remember. Starting Apache from the shell would show the mismatch of versions quite clearly â that was when I worked with PHP version 5.6. So this way I learned that Couchbase would not run on 5.6, whence I stepped back to PHP 5.5.20, resolving this issue.
So reasoning backwards I would argue that as we donât have any complaints anymore, by chance I hit the right version, okay?
Obviously this is not so, or something else is wrong.
Checking again, httpd does start from the shell (after having killed Couchbase sync server blocking port 80), but a notifying window appears twice showing the text âPHP Startup:â - nothing more. Starting Apache as a service does not show any hints.
Looking at the Apache error log, only the following is unusual:
Xdebug requires Zend Engine API version 220131226.
The Zend Engine API version 220121212 which is installed, is outdated.
Maybe this corresponds to the error window. Would make sense. But most probably this is not the reason for the problem in question, or is it? I understand that I should fetch an older version of Xdebug to fix this, but Xdebug is not the problem right now.
In C:\xampp\php\ext I find
php_couchbase.dll.140624 2014-06-24
which obviously is a version I could not work with earlier due to the aforementioned API mismatches (presumably with API 140624 - no, it stands for the date: 2014-06-24), and also
php_couchbase.dll 2015-01-21
which looks like being fresh from your very own workbench.
phpinfo() shows that the couchbase extension is not loaded with this (2015-01-21) version.
A quick test with the other version (2014-06-24) showed that Apache starts without complaint from the shell (so I guess I had problems with this one when I tested with PHP 5.6), and the Couchbase extension is loaded.
couchbase
Version 2.0
But donât open the champagne yet: I have a totally different error message. First my code:
phpinfo();
$clusterConnection = new CouchbaseCluster(âcouchbase://localhostâ);
Now the error which tells us equally well that the Couchbase system as such has been loaded.
Fatal error: Uncaught exception âCouchbaseExceptionâ with message âInvalid argumentsâ in CouchbaseNative:182 Stack trace: #0 CouchbaseNative(182): _CouchbaseCluster->__construct(âcouchbase://locâŚâ, ââ, ââ)
Using the sample code from couchbase.com:
$cb = new Couchbase(â127.0.0.1:8091â, âusernameâ, âpasswordâ, âdefaultâ);
we get
Fatal error: Class âCouchbaseâ not found
How and where can I find the right combination of PHP-version and php_couchbase.dll? This is a huge problem in itâs own.
github.com/maryo/php-5.5-windows-extensions (seems to be old)
pecl.php.net/package/couchbase/1.1.5/windows (version 1.x)
And thatâs it. Google doesnât give me any more hints.
Now letâs tackle with PHP first:
windows.php.net/download/
PHP 5.5 (5.5.21)
VC11 x64 Thread Safe (2015-Jan-22 03:12:55)
Letâs try this. Unfortunately, this version leads to an error:
Cannot load C:/xampp/php/php5ts.dll into server
because it is not a 32 bit application. Now what is this?
Okay, never mind, Iâll try it with PHP 32-bit:
VC11 x86 Thread Safe (2015-Jan-22 03:12:51)
Apache again starts without complaint from the shell. But my program says:
Fatal error: Class âMemcacheâ not found
Looks like my version of âMemcacheâ is not compatible with this one. Too bad. I remember finding the right version of memcached.dll wasnât easy either. Iâm not keen to dig into this mud once again.
As a quick hack, I put that one into coma, and finally here we have it in phpinfo():
couchbase
Version 2.0
This proves that php_couchbase.dll as of 2014-06-24 works with the latest php-5.5.21-Win32-VC11-x86 and 5.5.20 as well. Where did I get it from? I donât remember.
And again:
Fatal error: Uncaught exception âCouchbaseExceptionâ with message âInvalid argumentsâ in CouchbaseNative:182 Stack trace: #0 CouchbaseNative(182): _CouchbaseCluster->__construct(âcouchbase://locâŚâ, ââ, ââ)
But wait â Iâll have to make sure that I have the latest libcouchbase.dll as well. Which one is the right one? Right now I use one with timestamp will 2013-10-22. Why this mismatch? An âoutdatedâ libcouchbase.dll works with the latest PHP 5.5 and a php_couchbase.dll half a year old. Where does it come from?
From pecl.php.net/package/couchbase/1.1.5/windows I get
5.5 Thread Safe (TS) x86
with timestamp 2013-10-22. Obviously, libcouchbase.dll is taken from this package (php_couchbase-1.1.5-5.5-ts-vc11-x86.zip contains versions both of libcouchbase.dll and php_couchbase.dll from with date 2013-10-22).
This package however does not work (as expected), it yields no extension and Fatal error: Class âCouchbaseClusterâ âŚ
, so this is not the way to go.
Where did I get the latest php_couchbase.dll from? I didnât take notice and I canât find it anymore, Google or not.
But I did keep my unzipping directory (php_couchbase-2.0.3-5.5-zts-vc11-x64.zip), and there is no libcouchbase.dll provided (from the same source I discovered 2 days ago and canât find today).
Would any version of libcouchbase.dll do? What does zts mean? As I also have php_couchbase-2.0.3-5.5-nts-vc11-x64.zip I must interpret this version as non-thread-safe, so the other (zts) should most probably be thread-safe.
Both package versions donât contain libcouchbase.dll at all. What does this mean? Is the old version good enough so that there is no need to provide one? This doesnât make sense as somebody could start with this version and not have any older package, so he wouldnât have no libcouchbase.dll at all. Why is there no libcouchbase.dll in these packages?
Ah, here I got it from: pecl.php.net/package/couchbase â or not? No, this one is a tgz file, not a zip file as the other. Actually I downloaded this 2015-01-11 already in order to learn that this is the source code â of the client, that is.
README.md
The extension will become available via PECL once it leaves the DP phase. Until then, you may install by downloading a prebuilt binary of the DP available on couchbase.com for the Windows platform âŚ
docs.couchbase.com/developer/c-2.4/download-install.html
You can install the C SDK from a repository for your platform, download prebuilt binaries, or compile from source.
No, you canât, there are no prebuilt binaries.
Okay, Iâll be bold and just try to make up an address analogously to the other one: pecl.php.net/package/couchbase/2.0.3/windows â nope, no chance.
Looking at my download area, I find a directory libcouchbase-2.4.6.zip, downloaded 2 days ago from I donât know where, which seems to be the source code (github.com/couchbase/libcouchbase/releases). I donât think Iâm going to compile this. Do I need it at all? Would make sense, or not?
Iâm totally confused and lost. You are the expert. Can you make sense of all that?
Since I started investigating Couchbase, I spent many hours, in total a couple of days trying to set up Couchbase on my system, and in spite of this effort I didnât learn that much. Too bad.
Is it all my fault? Am I just not clever enough for this kind of system? I donât think so.
Obviously, there are some very serious organizational flaws which not only deprive me of valuable lifetime but also many others including the developers who try to help those poor guys daring to ask for help.
Of course Iâd rather resolve this issue one way or another so this effort might not be totally wasted. For the moment I returned to PHP version 5.6.3 and got a very nice warning window:
PHP Startup: couchbase: Unable to initialize module
Module compiled with module API=20121212
PHP compiled with module API=20131226
These options need to match
This warning does not show with the latest version of php_couchbase.dll, but still the extension is not loaded. As PHP 5.6.x is not supported yet, I am not surprised.
The stub code obviously came from github.com/brett19/php-couchbase; alas, as vital parts are missing, I canât help myself with this:
Fatal error: Class â_CouchbaseBucketâ not found
Well, no doubt someday later weâll all have it running without problems, thanks to numerous people (or rather a few heroic ones, maybe only one after all, totally left on his own) who tirelessly and thanklessly serve the world (no irony intended).
So Iâd better be patient and wait long enough. Or do you have an advice which cuts through all of this?