PHP sdk issues at startup

Hi everyone, I just installed a fresh copy of CentOS 6.3 64bits and installed Couchbase server 2.0
After installing several libs (crypto, ssl, etc) I was able to run Couchbase and access it from the web console.
I've downloaded the php sdk from http://www.couchbase.com/develop/php/current for CentOS 6.2 -I assume it works on 6.3- from http://packages.couchbase.com/clients/php/php-ext-couchbase-1.1.2-centos..., uncompressed it, copied the couchbase.so extension to the php extensions, and added the line to the php.ini in order to be loaded.
I ran php -i but I got an error message about libcouchbase.so.2 was not found, after some digging I came up to:
https://github.com/couchbase/libcouchbase
cloned the git repo, compiled and installed it.
Now, I can start/restart apache without any issue, but when I execute "php -i" in order to check if Couchbase sdk is loaded I get the following error:
Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/couchbase.so' - libcouchbase.so.2: cannot open shared object file: No such file or directory in Unknown on line 0
I've tried to symlink and even copy the libcouchbase.* files to /usr/lib64/php/modules/ and even added /usr/local/lib/ to the include_path in php.ini, nothing of this raised a different error message.
I don't have to say that I'm lost due to the error message that doesn't points me to any direction, and I wasn't able to find the same issue on google or forums.
Can someone point me out what to try next?

Forgot to mention, I think it's not relevant but just in case, the CentOS is running in a VirtualBox 4 on a Win 6 64 host.

Fixed the issue, I've found this article:
http://www.6tech.org/2013/02/installing-couchbase-on-centos-6-3-php-5-3-21/
by installing libcouchbase rpm from the couchbase repo fixed the issue, in two lines:
#add the repo URL to yum
wget -O /etc/yum.repos.d/couchbase.repo http://packages.couchbase.com/rpm/couchbase-centos62-x86_64.repo
#install the packages
yum install -y libcouchbase2 libcouchbase-devel
I just think that the PHP SDK page should promptly mention this somehow, as I've read in another forum post, couchbase may be a great data server, but without a client library is useless....

1 Answer

« Back to question.

Yeah, we certainly have a way to go in order to make it easier for people to use our clients. Part of the problem is that there is so many different operating systems out there so it is quite some work left to make it easy for all of them. From looking at http://www.couchbase.com/develop/php/current I noticed that the first step is to go install libcouchbase with a link to http://www.couchbase.com/develop/c/current which does contain a fair amount of information on how to install it on different OS's. This list should probably be extended with more platforms.

Hi trond, of course, after I found the web and go over again on the steps you mention on the sdk page, I must admit that I didn't read it carefully enough.
Besides that, I think the SDK should report the issue about libcouchbase not being present in a better and clear way, it should be fairly simply to check from the SDK if libcouchbase can be loaded or not, if not, print some error message that points out the user to install it, in my case, the error message was not leading me anywhere, in addition that the exact error message wasn't found on any page/blog/forum so I was literally lost.

Currently our extension is built in such a way that it is linked with libcouchbase resulting in that it is the runtime linker that refuse to load the entire couchbase.so module. We could of course try to dlopen the module ourself and return a better error message (and implement that on all platforms..). I'm currently looking into putting the extension in PECL to make it easier for people to install.

That would really will help to troubleshoot a client setup, btw, I've also tried the Windows versions for php 5.3 and 5.4 on win7, for 5.4 I've used the latest xampp version (1.8.1) and it wasn't able to load the dll, just a standard error message that apache couldn't load (used the correct TS version of the dlls), I've found a post of yours about setting it up on IIS, but IMHO, most php devs will use xampp (or another apache/php/mysql stack) instead of iis when developing on windows, so I understand that may be an issue on configuring php to use CB sdk when running as an apache module instead of iis... didn't found any information related to this matters.
I must tell it's very frustrating when you don't have a single piece of indidication about what went wrong, that's why I believe a better error handling and reporting will improve user (developers) experience, these days, most of devs do not have time to be hacking around to get things working, and CB is a great product to work with, you just need to improve the sdk and I'm sure more developers will use it.
Best regards!

I'll try to look into how hard it is to fix this issue properly (I would assume its not _that_ hard). Do you have a link to a good description on how to set up an XAMPP stack on windows and I'll try to put up a blog on how to get everything working there as well (and get that into our documentation as well).
Best regards,

Sure, here it is:
http://www.apachefriends.org/en/xampp-windows.html#641, download the one labeled as "Installer" (direct link: http://www.apachefriends.org/download.php?xampp-win32-1.8.1-VC9-installe...)
That will install the full apache/php/mysql stack, php version 5.4.7, php is thread safe
I'm running W7 64 ultimate if you need testing.
Hope you get it running! plz let me know if I can help in any way!
Regards.

Sorry for the late answer, but I was busy doing family stuff with the kids. I got it working under XAMPP, but I haven't written a blog post about it yet. It turns out that it was "the same frustrating problem" with libcouchbase here as well (it could be other reasons as well, because I just built the extension from source)
What I did was to copy the php_couchbase.dll to c:\xampp\php\ext, then copy libcouchbase.dll to c:\xampp\apache\bin (for it to work under apache) and to c:\xampp\php to make it work on the command line.
And I added:

extension=php_couchbase.dll

to php.ini

Hi Trond, thanks a lot for taking the time to look into it. I did what you pointed out and it worked!
I've wrote a stackoverflow self-answered question for anyone that may need it!
http://stackoverflow.com/questions/15787715/installing-couchbase-client-...

trond wrote:
What I did was to copy the php_couchbase.dll to c:\xampp\php\ext, then copy libcouchbase.dll to c:\xampp\apache\bin (for it to work under apache) and to c:\xampp\php to make it work on the command line.
And I added:

extension=php_couchbase.dll

to php.ini

I will try with xampp by curiosity but i did the same work with Softaculous AMPPS http://www.ampps.com/ before finding this thread but without success. An idea would be welcome.
I suggested Softaculous to integrate couchbase into their product line (webuzo, ampps, softaculous) too, you can second the suggestion on their forum to have a straightforward couchbase automatic installation on whatever linux, windows...