Couchbase PHP extension on CentOS 5.8 with Zend Server and PHP 5.4

Hi,

So I'm trying to install the Couchbase PHP extension on CentOS 5.8 with Zend Server and PHP 5.4. I installed the C library and I downloaded the couchbase.so(the centos55 version) file but PHP doesn't seem to want to load it. If I run php -me, it shows the error:
PHP Warning: PHP Startup: couchbase: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API=20100525
These options need to match
in Unknown on line 0

So this makes sense, after all I'm using a version that is meant for CentOS 5.5, so download the source and I try to compile it but I seem to run into some issues. I get to the ./configure step and among other things it spits out:
configure: error: Cannot find php_json.h

I can't find anything on how to install this or find it. Anyone have any ideas?

I'm trying to use
Couchbase 1.8.1 CE Server
The C/C++ Couchbase Client Library v 1.X
I've tried the current version of the php extension code from github, which is apparently for the v 2.0 C Couchbase Library, as well as the v 1.0 code for the php extension. the v 2.0 says its incompatible and I get the errors when compiling the v 1.0 of the code.

Any Ideas?

Thanks,
Jordan

P.S. I should also note that I tried I also tried installing the 2.0 version of the Couchbase C library to fix the incompatibility with the newest php extension but I get a dependency error for libev.so.4 and I can't seem to find that anywhere. However after that's installed I think I'll still run into the php_json.h error described above.

So as an update, I was able to compile the php-ext-couchbase files after manually getting the php_json.h file and putting it where it needed to be. I also upgraded everything to the 2.0 Beta and have installed the C Libraries and php extension to match. However now I'm receiving the error:
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
when I try to view my test page.

In my PHP Log It shows the warning:
PHP Warning: Couchbase::__construct(): Failed to create libcouchbase instance in /var/www/html/index.php on line 22

I'm not sure why I'm getting the HTTP error, I would think it should show a blank page or a page with the PHP warning. More importantly, I don't know why its not creating the libcouchbase instance. The extension is being loaded and the library is installed. I would think it should work.

If I look at my installed programs through yum, I noticed that I libcouchbase2-core and libcouchbase-devel installed. There is a libcouchbase2 available, do I need that instead? I tried installing it but I ran into dependency issues with libev, I can't find that library anywhere.

Any Ideas?
Thanks,
Jordan

1 Answer

« Back to question.

To answer my own question, yes I needed the libcouchbase2 component. I found my missing dependencies in the epel repositories.
Problem solved

I have tried a variety of installations using CB 2.0 on CentOS 5.8 and 6.2 with Zend Server 5.3 and 5.4 and without Zend Server. I have been unable to get the PHP extension to work. I always end up at the same place with no errors but a fault: [notice] child pid 5861 exit signal Segmentation fault (11)
Maybe you can provide the steps you took to get this working on CentOS 5.8 or possibly 6.2?

thanks,
W3Evolutions

I had the same problem as you, I installed the whole Couchbase stack (server, C library, PHP extension) on Rackspace CentOS 6.3 some weeks ago and everything worked a-ok. The repository I used was Couchbase's official repo.

Some days ago, the PHP extension started crashing with Segmentation fault in a function called crc2tab something. Without knowing where the problem resided, I tried reinstalling everything on Ubuntu 10, Ubuntu 11, but I still got the same segmentation fault. I also rebuilt the server from an image I had saved, but it worked only for a couple of hours, then crashes again.
In the end, I isolated the problem. I think the latest packages from the repository are broken, at least for my setup. When I tried to install them on new servers, they crash constantly. Also, Rackspace does a silent automatic update of packages to the latest versions, so that's why I got crashes even on the saved image after a couple of hours.

Try installing older packages if you have them or can find them somewhere.

Thanks for the reply mirsilstan, I ended up resolving my issue by compiling the extension specifically for my distro version(CentOS 5.8). I installed the 5.5 versions of the server and the C Library and they worked fine although I did need a few dependencies for the C Library to install correctly. Finding them wasn't exactly intuitive but I ended up getting them off of the EPEL Repository.

I had some issues with the dependencies while compiling the php extension just because I'm not as familiar with php extensions. I had to install some php libraries that were required. The php_json.h file was one that I had to download specifically.

I got the code on github: https://github.com/couchbase/php-ext-couchbase. There are instructions at the bottom. The dependencies I had to figure out on my own (well with google's help).

Just as a note: I'm using the 2.0 Beta versions of the server and both libraries.

Take Care,
Jordan

Here is where I get stuck:
1. yum update
2. yum install gcc
3. /etc/init.d/iptables stop (for now)
4. nano /etc/yum.repos.d/zend.repo (http://static.zend.com/topics/Zend-Server-Installation-Guide-5-6.pdf)
[Zend]
name=Zend Server
baseurl=http://repos.zend.com/zend-server/rpm/$basearch
enabled=1
gpgcheck=1
gpgkey=http://repos.zend.com/zend.key

[Zend_noarch]
name=Zend Server - noarch
baseurl=http://repos.zend.com/zend-server/rpm/noarch
enabled=1
gpgcheck=1
gpgkey=http://repos.zend.com/zend.key

5. yum check-update
6. yum update
7. yum install zend-server-php-5.3
8. yum clean all
9. cd ~
10. nano /etc/profile
PATH=$PATH:/usr/local/zend/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/zend/lib

11. source /etc/profile
12. setenforce off
13. wget http://packages.couchbase.com/releases/2.0.0-beta/couchbase-server-commu... (http://www.couchbase.com/download?next=true)
14. rpm -i couchbase-server-community_x86_64_2.0.0-beta.rpm
error: Failed dependencies:
libcrypto.so.6()(64bit) is needed by couchbase-server-2.0.0-1723.x86_64
libssl.so.6()(64bit) is needed by couchbase-server-2.0.0-1723.x86_64

15. yum install openssl098e (http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-getting-sta...)
16. rpm -i couchbase-server-community_x86_64_2.0.0-beta.rpm
17. wget -O/etc/yum.repos.d/couchbase.repo http://packages.couchbase.com/preview/rpm/couchbase-centos62-x86_64.repo (http://www.couchbase.com/develop/c/next)
18. yum check-update yum update yum install -y libcouchbase2 libcouchbase-devel
Error: Package: libcouchbase2-libev-2.0.0-1.x86_64 (couchbase)
Requires: libev.so.4()(64bit)
Error: Package: libcouchbase2-libev-2.0.0-1.x86_64 (couchbase)
Requires: libev >= 3
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
19. wget http://mirrors.syringanetworks.net/fedora-epel/6/i386/epel-release-6-7.n...
20. rpm -i epel-release-6-7.noarch.rpm
21. yum install libev
22. yum install -y libcouchbase2 libcouchbase-devel
23. git clone https://github.com/couchbase/php-ext-couchbase.git
24. cd /usr/local/zend/bin/phpize
25. /usr/local/zend/bin/phpize
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

26. yum install autoconf
27. yum install make
28. /usr/local/zend/bin/phpize
29. ./configure
checking for json includes... configure: error: Cannot find php_json.h

30. cd ~
31. wget http://us2.php.net/distributions/php-5.3.14.tar.gz
32. tar xzvf php-5.3.14.tar.gz
33. cd php-5.3.14/ext/
34. cp -R json /usr/local/zend/include/php/ext/
35. cd ~/php-ext-couchbase
36. ./configure
configure: error: couchbase support requires ZLIB. Use --with-zlib-dir= to specify the prefix where ZLIB headers and library are located
37. yum install zlib
Package zlib-1.2.3-27.el6.x86_64 already installed and latest version
38. yum install libvbu*
39. yum install zlib-devel
40 ./configure
41. make
42. make test
=================================================================
TIME END 2012-11-30 16:41:39
=================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped : 0
Exts tested : 23
---------------------------------------------------------------------
Number of tests : 155 142
Tests skipped : 13 ( 8.4%) --------
Tests warned : 0 ( 0.0%) ( 0.0%)
Tests failed : 142 ( 91.6%) (100.0%)
Expected fail : 0 ( 0.0%) ( 0.0%)
Tests passed : 0 ( 0.0%) ( 0.0%)
---------------------------------------------------------------------
Time taken : 7 seconds
=================================================================
=================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
AppendPrepend - AppendCas [tests/phpt/AppendPrepend/AppendCas.phpt]
AppendPrepend - AppendInvalidCas [tests/phpt/AppendPrepend/AppendInvalidCas.phpt]
AppendPrepend - AppendNonExist [tests/phpt/AppendPrepend/AppendNonExist.phpt]
AppendPrepend - AppendPrepend [tests/phpt/AppendPrepend/AppendPrepend.phpt]
AppendPrepend - AppendPrependOO [tests/phpt/AppendPrepend/AppendPrependOO.phpt]
Arithmetic - CustomOffset [tests/phpt/Arithmetic/CustomOffset.phpt]
Arithmetic - Expiry [tests/phpt/Arithmetic/Expiry.phpt]
Arithmetic - IncrDecr [tests/phpt/Arithmetic/IncrDecr.phpt]
Arithmetic - IncrDecrNonexist [tests/phpt/Arithmetic/IncrDecrNonexist.phpt]
Arithmetic - IncrDecrNonexistOO [tests/phpt/Arithmetic/IncrDecrNonexistOO.phpt]
Arithmetic - IncrDecrNonexistPositional [tests/phpt/Arithmetic/IncrDecrNonexistPositional.phpt]
Arithmetic - IncrDecrNonexistPositionalOO [tests/phpt/Arithmetic/IncrDecrNonexistPositionalOO.phpt]
Arithmetic - IncrDecrOO [tests/phpt/Arithmetic/IncrDecrOO.phpt]
Arithmetic - IncrString [tests/phpt/Arithmetic/IncrString.phpt]
Arithmetic - IncrStringOO [tests/phpt/Arithmetic/IncrStringOO.phpt]
Cluster - BucketCreate [tests/phpt/Cluster/BucketCreate.phpt]
Cluster - GetInfo [tests/phpt/Cluster/GetInfo.phpt]
Cluster - InvalidParams [tests/phpt/Cluster/InvalidParams.phpt]
Compression - CompressionFastLZ [tests/phpt/Compression/CompressionFastLZ.phpt]
Compression - CompressionFlags [tests/phpt/Compression/CompressionFlags.phpt]
Compression - CompressionZlib [tests/phpt/Compression/CompressionZlib.phpt]
Connection - ConnectBad [tests/phpt/Connection/ConnectBad.phpt]
Connection - ConnectBadOO [tests/phpt/Connection/ConnectBadOO.phpt]
Connection - ConnectBadUri [tests/phpt/Connection/ConnectBadUri.phpt]
Connection - ConnectBasic [tests/phpt/Connection/ConnectBasic.phpt]
Connection - ConnectDelimitedNodes [tests/phpt/Connection/ConnectDelimitedNodes.phpt]
Connection - ConnectNodeArray [tests/phpt/Connection/ConnectNodeArray.phpt]
Connection - ConnectOO [tests/phpt/Connection/ConnectOO.phpt]
Connection - ConnectUri [tests/phpt/Connection/ConnectUri.phpt]
Connection - PersistentConnection [tests/phpt/Connection/PersistentConnection.phpt]
Delay - AnonCb [tests/phpt/Delay/AnonCb.phpt]
Delay - ContentCb [tests/phpt/Delay/ContentCb.phpt]
Delay - FetchAll [tests/phpt/Delay/FetchAll.phpt]
Delay - FetchOne [tests/phpt/Delay/FetchOne.phpt]
Delay - InvalidCb [tests/phpt/Delay/InvalidCb.phpt]
Delete - Delete [tests/phpt/Delete/Delete.phpt]
Delete - DeleteNonExist [tests/phpt/Delete/DeleteNonExist.phpt]
Delete - DeleteOO [tests/phpt/Delete/DeleteOO.phpt]
EmptyKey - EmptyKeyAdd [tests/phpt/EmptyKey/EmptyKeyAdd.phpt]
EmptyKey - EmptyKeyGet [tests/phpt/EmptyKey/EmptyKeyGet.phpt]
EmptyKey - EmptyKeyGetMulti [tests/phpt/EmptyKey/EmptyKeyGetMulti.phpt]
EmptyKey - EmptyKeyReplace [tests/phpt/EmptyKey/EmptyKeyReplace.phpt]
EmptyKey - EmptyKeySet [tests/phpt/EmptyKey/EmptyKeySet.phpt]
EmptyKey - EmptyKeySetMulti [tests/phpt/EmptyKey/EmptyKeySetMulti.phpt]
Errors - ErrorCodes [tests/phpt/Errors/ErrorCodes.phpt]
Expiry - ArithmeticExpiry [tests/phpt/Expiry/ArithmeticExpiry.phpt]
Expiry - ExpirySetOO [tests/phpt/Expiry/ExpirySetOO.phpt]
Expiry - ExpirySetZeroOO [tests/phpt/Expiry/ExpirySetZeroOO.phpt]
Expiry - ExpiryTouch [tests/phpt/Expiry/ExpiryTouch.phpt]
Expiry - ExpiryTouchMulti [tests/phpt/Expiry/ExpiryTouchMulti.phpt]
Expiry - NegativeExpirySet [tests/phpt/Expiry/NegativeExpirySet.phpt]
Extension - ExtensionBasic [tests/phpt/Extension/ExtensionBasic.phpt]
Extension - ExtensionCouchbaseClassAvailable [tests/phpt/Extension/ExtensionCouchbaseClassAvailable.phpt]
Flush - Flush [tests/phpt/Flush/Flush.phpt]
Flush - FlushOO [tests/phpt/Flush/FlushOO.phpt]
Get - GetWithCallback [tests/phpt/Get/GetWithCallback.phpt]
Get - GetWithCallbackOO [tests/phpt/Get/GetWithCallbackOO.phpt]
Get - GetWithLock [tests/phpt/Get/GetWithLock.phpt]
Get - GetWithLockOO [tests/phpt/Get/GetWithLockOO.phpt]
Get - GetWithTouch [tests/phpt/Get/GetWithTouch.phpt]
Get - GetWithTouchOO [tests/phpt/Get/GetWithTouchOO.phpt]
Get - NonExistentKey [tests/phpt/Get/NonExistentKey.phpt]
Get - NonExistentKeyOO [tests/phpt/Get/NonExistentKeyOO.phpt]
Get - Plain [tests/phpt/Get/Plain.phpt]
Get - PlainOO [tests/phpt/Get/PlainOO.phpt]
GetMulti - MgetOrdered [tests/phpt/GetMulti/MgetOrdered.phpt]
GetMulti - MgetPartial [tests/phpt/GetMulti/MgetPartial.phpt]
GetMulti - Plain [tests/phpt/GetMulti/Plain.phpt]
GetMulti - PlainOO [tests/phpt/GetMulti/PlainOO.phpt]
GetMulti - SetMulti [tests/phpt/GetMulti/SetMulti.phpt]
GetMulti - SetMultiOO [tests/phpt/GetMulti/SetMultiOO.phpt]
Info - GetSetTimeout [tests/phpt/Info/GetSetTimeout.phpt]
Info - GetSetTimeoutOO [tests/phpt/Info/GetSetTimeoutOO.phpt]
Info - NumReplicas [tests/phpt/Info/NumReplicas.phpt]
Info - NumReplicasOO [tests/phpt/Info/NumReplicasOO.phpt]
Info - ServerList [tests/phpt/Info/ServerList.phpt]
Info - ServerListOO [tests/phpt/Info/ServerListOO.phpt]
IntegerArgs - IntKeyArgs [tests/phpt/IntegerArgs/IntKeyArgs.phpt]
IntegerArgs - IntValueArgs [tests/phpt/IntegerArgs/IntValueArgs.phpt]
MiscOptions - MiscOptions [tests/phpt/MiscOptions/MiscOptions.phpt]
MissCB - MissCb [tests/phpt/MissCB/MissCb.phpt]
MissCB - MissCbOO [tests/phpt/MissCB/MissCbOO.phpt]
MutateBasic - Add [tests/phpt/MutateBasic/Add.phpt]
MutateBasic - AddExisting [tests/phpt/MutateBasic/AddExisting.phpt]
MutateBasic - AddOO [tests/phpt/MutateBasic/AddOO.phpt]
MutateBasic - Cas [tests/phpt/MutateBasic/Cas.phpt]
MutateBasic - CasOO [tests/phpt/MutateBasic/CasOO.phpt]
MutateBasic - Flush [tests/phpt/MutateBasic/Flush.phpt]
MutateBasic - Set [tests/phpt/MutateBasic/Set.phpt]
MutateBasic - SetOO [tests/phpt/MutateBasic/SetOO.phpt]
NonASCII - 8BitSafeKey [tests/phpt/NonASCII/8BitSafeKey.phpt]
NonASCII - EmbeddedNul [tests/phpt/NonASCII/EmbeddedNul.phpt]
NonASCII - ZeroLengthValue [tests/phpt/NonASCII/ZeroLengthValue.phpt]
Observe - BadParams [tests/phpt/Observe/BadParams.phpt]
Observe - BasicMultiObserve [tests/phpt/Observe/BasicMultiObserve.phpt]
Observe - BasicMultiObserveOO [tests/phpt/Observe/BasicMultiObserveOO.phpt]
Observe - BasicObserve [tests/phpt/Observe/BasicObserve.phpt]
Observe - BasicObserveOO [tests/phpt/Observe/BasicObserveOO.phpt]
Observe - KeyDurability [tests/phpt/Observe/KeyDurability.phpt]
Observe - KeyDurabilityOO [tests/phpt/Observe/KeyDurabilityOO.phpt]
Observe - Modified [tests/phpt/Observe/Modified.phpt]
Observe - MultiEmpty [tests/phpt/Observe/MultiEmpty.phpt]
Observe - PollingExcessive [tests/phpt/Observe/PollingExcessive.phpt]
Observe - PollingMultiMixed [tests/phpt/Observe/PollingMultiMixed.phpt]
Observe - SnapshotEmpty [tests/phpt/Observe/SnapshotEmpty.phpt]
Observe - Timeout [tests/phpt/Observe/Timeout.phpt]
Prefix - InvalidPrefix [tests/phpt/Prefix/InvalidPrefix.phpt]
Prefix - Prefix [tests/phpt/Prefix/Prefix.phpt]
Replace - Replace [tests/phpt/Replace/Replace.phpt]
Replace - ReplaceCas [tests/phpt/Replace/ReplaceCas.phpt]
Replace - ReplaceInvalidCas [tests/phpt/Replace/ReplaceInvalidCas.phpt]
Replace - ReplaceOO [tests/phpt/Replace/ReplaceOO.phpt]
Serialization - MixedSerializationErrors [tests/phpt/Serialization/MixedSerializationErrors.phpt]
Serialization - SerializeAppend [tests/phpt/Serialization/SerializeAppend.phpt]
Serialization - SerializeBasic [tests/phpt/Serialization/SerializeBasic.phpt]
Serialization - SerializeFileError [tests/phpt/Serialization/SerializeFileError.phpt]
Serialization - SerializeJsonArrayMixed [tests/phpt/Serialization/SerializeJsonArrayMixed.phpt]
Serialization - SerializeJsonObjectMixed [tests/phpt/Serialization/SerializeJsonObjectMixed.phpt]
Serialization - SerializerOptions [tests/phpt/Serialization/SerializerOptions.phpt]
Serialization - SerializerOptionsOO [tests/phpt/Serialization/SerializerOptionsOO.phpt]
ServerStats - Issue115 [tests/phpt/ServerStats/Issue115.phpt]
ServerStats - Stats [tests/phpt/ServerStats/Stats.phpt]
ServerStats - Version [tests/phpt/ServerStats/Version.phpt]
Store - AddSingle [tests/phpt/Store/AddSingle.phpt]
Store - AddSingleOO [tests/phpt/Store/AddSingleOO.phpt]
Store - AddWhenExists [tests/phpt/Store/AddWhenExists.phpt]
Store - AddWhenExistsOO [tests/phpt/Store/AddWhenExistsOO.phpt]
Store - SetMulti [tests/phpt/Store/SetMulti.phpt]
Store - SetMultiOO [tests/phpt/Store/SetMultiOO.phpt]
Store - SetSingle [tests/phpt/Store/SetSingle.phpt]
Store - SetSingleOO [tests/phpt/Store/SetSingleOO.phpt]
ViewQueryStrings - BadStale [tests/phpt/ViewQueryStrings/BadStale.phpt]
ViewQueryStrings - EncodeStringToJson [tests/phpt/ViewQueryStrings/EncodeStringToJson.phpt]
ViewQueryStrings - MiscBooleans [tests/phpt/ViewQueryStrings/MiscBooleans.phpt]
ViewQueryStrings - MiscNumeric [tests/phpt/ViewQueryStrings/MiscNumeric.phpt]
ViewQueryStrings - PassThrough [tests/phpt/ViewQueryStrings/PassThrough.phpt]
ViewQueryStrings - StaleParams [tests/phpt/ViewQueryStrings/StaleParams.phpt]
ViewQueryStrings - UnrecognizedParam [tests/phpt/ViewQueryStrings/UnrecognizedParam.phpt]
ViewSimple - BasicView [tests/phpt/ViewSimple/BasicView.phpt]
ViewSimple - MissingView [tests/phpt/ViewSimple/MissingView.phpt]
ViewSimple - NoRes [tests/phpt/ViewSimple/NoRes.phpt]
ViewSimple - SingleUri [tests/phpt/ViewSimple/SingleUri.phpt]
=================================================================

W3Evo,

I'm sorry but I'm just not sure. The only difference between our setups is that you're using PHP 5.3. You ran into the same dependency issues that I did. I will say that I ran into a similar error when I ran my "make test" because I copied down the wrong version of the json file for my installation. I copied down a 5.2 version of it when I'm using PHP 5.4.

That's all I can really say for sure,
Jordan

Jordan, thanks for the reply. When you downloaded the json extension where did you place the folder? Or did you just copy the header file somewhere?

thanks,

Brandon Kozak
W3Evolutions LLC

Brandon,
I copied just the header file to /usr/local/zend/include/php/ext/json. I had to make the json directory at the end of it. So the file path is /usr/local/zend/include/php/ext/json/php_json.h. I found a stack overflow post regarding it: http://stackoverflow.com/questions/6849401/cant-find-php-json-h-on-my-ub...
I just had to change the php version of the file that the post references.

-Jordan

1. yum update
2. rpm -ivh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
3. yum update
4. nano /etc/yum.repos.d/zend.repo
[Zend]
name=Zend Server
baseurl=http://repos.zend.com/zend-server/preview-php5.4/rpm/$basearch
enabled=1
gpgcheck=1
gpgkey=http://repos.zend.com/zend.key
[Zend_noarch]
name=Zend Server - noarch
baseurl=http://repos.zend.com/zend-server/preview-php5.4/rpm/noarch
enabled=1
gpgcheck=1
gpgkey=http://repos.zend.com/zend.key

5. yum update
6. yum clean all
7. yum install git gcc autoconf make
8. setenforce 0
9. /etc/init.d/iptables stop (for now)
10. yum install zend-server-php-5.4
11. cd ~
12. nano /etc/profile
PATH=$PATH:/usr/local/zend/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/zend/lib

13. source /etc/profile
14. wget http://packages.couchbase.com/releases/2.0.0-beta/couchbase-server-commu... (http://www.couchbase.com/download?next=true)
15. rpm -i couchbase-server-community_x86_64_2.0.0-beta.rpm
16. wget -O/etc/yum.repos.d/couchbase.repo http://packages.couchbase.com/preview/rpm/couchbase-centos55-x86_64.repo
17. yum check-update
18. yum update
19. yum clean all
20. yum install -y libcouchbase2 libcouchbase-devel
21. tum install git
22. git clone https://github.com/couchbase/php-ext-couchbase.git
-----
STOP
-----
Make sure to setup couchbase on the server via the URL before continuing or else the make test will auto fail as it won't connect.
-----
continue
-----
23. phpize
24. ./configure
checking for json includes... configure: error: Cannot find php_json.h
25. mkdir /usr/local/zend/include/php/ext/json
26. nano /usr/local/zend/include/php/ext/json/php_json.h (http://svn.php.net/viewvc/php/php-src/tags/php_5_4_0/ext/json/php_json.h...)
27. ./configure
configure: error: couchbase support requires ZLIB. Use --with-zlib-dir= to specify the prefix where ZLIB headers and library are located
28. yum install zlib-devel
29. ./configure
30. make
31. make test
FAIL

Still no go :(

What happens at step 31? It just prints FAIL? Is there any output?

You may want to try a "git clean -dfx" since you've changed a few things in there. In theory, rerunning configure should be fine, but in practice sometimes it's better to clean up and restart from phpize.

A couple of other comments. One is that Couchbase does not have official support for PHP 5.4 yet. That's mostly because there are some things that require re-building. That said, 5.4 is known to work and support is coming.

The other comment is that the json header issue is a bit of a red flag. PHP core contributors[1] have confirmed to Couchbase that the way Red Hat is building things is outside their recommendation and not exposing the JSON symbols as a result. Grabbing a header file should be an okay workaround, but it's hard to say that there aren't any changes there for sure. Does the package from yum align exactly to that header? You're on zend server 5.4, which could be again different. I don't know that's the issue, just don't know where it is based on the above.

In any event, I'm sure we can get this resolved. Let us know what's happening at step 31!
1. http://www.couchbase.com/issues/browse/PCBC-141?focusedCommentId=43756&p...

Ingethr, thanks for the reply.

I get the exact same results as my earlier post. Also note my earlier attempts were with PHP5.3.
I would rather have PHP5.3 with or without Zend Framework however the original poster of this thread started with 5.4 so I figured I would give it a try.

I don't know if the rpm is in align with the json header file.

In any case, using the instructions from couhcbase ends in a segmentation fault with or without Zend Server, with PHP 5.3 or PHP 5.4 on CentOS 5.8 and CentOS 6.2 and Ubuntu 10 and 11. Trying to compile in any way on any OS results in a MAKE TEST with all test Failed or Skipped.

thanks,
Brandon Kozak

In that case, let's go back to the most supported/tested configuration which is the built in PHP 5.3. That seems to be what you tried at first.

If you run "ulimit -c unlimited", when it segfaults it should generate a core file. If you can get that to us over at http://www.couchbase.com/issues/browse/PCBC in an issue as an attachment, we can probably determine why. Please include all details on OS version, architecture and PHP package origin so we can get info out of the core. The other thing you *could* do (which would speed how we can address the issue) is try to:
"gdb "
and then give gdb the command:
"thr a a bt"
followed by a CTRL-D.
That'll give a backtrace which should pinpoint what is segfaulting.
I don't think that's something that's been seen before. Sorry for the hassle-- I'm sure we can track it down.
(p.s.: I'm with Couchbase, sometimes speaking in the 3rd person, sometimes in the 1st person-- sorry!)

Can you try, as much as possible, resetting to stock Centos 5.8 and installing all needed tools (PHP, nginx, etc.) from yum using the Couchbase centos55 repo and the EPEL + remi repos.

[root@localhost ~]# yum list installed | egrep 'php|couch|vbuck'
couchbase-server.x86_64 1.8.1-937 installed
libcouchbase-devel.x86_64 2.0.1-1 installed
libcouchbase2-core.x86_64 2.0.1-1 installed
libvbucket1.x86_64 1.8.0.4-1 installed
php.x86_64 5.3.15-1.el5.remi installed
php-cli.x86_64 5.3.15-1.el5.remi installed
php-common.x86_64 5.3.15-1.el5.remi installed
php-devel.x86_64 5.3.15-1.el5.remi installed
php-fpm.x86_64 5.3.15-1.el5.remi installed
php-pear.noarch 1:1.9.4-11.el5.remi.1 installed
php-pecl-igbinary.x86_64 1.1.1-2.el5.remi installed
php-pecl-memcached.x86_64 2.1.0-4.el5.remi installed
[root@localhost ~]# ls /etc/yum.repos.d/
aegisco.repo CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo couchbase.repo epel.repo epel-testing.repo rbel5.repo remi.repo
[root@localhost ~]# cat /etc/yum.repos.d/remi.repo
[remi]
name=Les RPM de remi pour Enterprise Linux $releasever - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/$releasever/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/$releasever/remi/mirror
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
failovermethod=priority
[remi-test]
name=Les RPM de remi en test pour Enterprise Linux $releasever - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/$releasever/test/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/$releasever/test/mirror
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
[root@localhost ~]# cat /etc/yum.repos.d/couchbase.repo
[couchbase]
name = Couchbase package repository
baseurl = http://packages.couchbase.com/rpm/5.5/x86_64
gpgcheck = 1
gpgkey = http://packages.couchbase.com/rpm/couchbase-rpm.key
[root@localhost ~]#

I would recommend trying a clean slate as much as possible, and use the above well-known repos for packages. It should work fine together. You shouldn't need to compile anything from source, although I have tested building php-ext-couchbase from the git master branch as well. I have *not* gone down the trail of building PHP from source, etc., but the above combo should just work, using only yum for installing packages (and just copying the couchbase.so from the Couchbase PHP client lib to the appropriate place for PHP to find it).

Let us know if this is a feasible approach for you to take, to get to a known and sane environment.
Finally, if you get the couchbase extension to load OK, but are hitting other problems, maybe try running a very simple program from the command line under 'strace' and post the results:

Couchbase Server PHP Test

<?php

$cb = new Couchbase("127.0.0.1:8091", "Administrator", "password", "default");
$cb->set("a", "OSDIFOISJDFOIJ");

echo("The value for 'a' is: ");
var_dump($cb->get("a"));

?>

# strace php cb-simple.php > strace.out 2>&1

Post the strace.out file, after ensuring that it has something possibly meaningful in it. You might try changing the username, password, and bucket settings if needed, etc.

Tim