PHP 7 (PHPNG) Couchbase driver

I’m probably stupid, but i don’t know how i can private message you.
So this is my answer :
I got the feeling that PHP is not a priority for you.
You probably want make CouchBase very popular and used in the whole world, PHP is a language massively used for websites, even on very big one. So you should put PHP language at the top of your priority .

The driver should already be available for PHP7.

@srm // I too feel that PHP is not a priority for the Couchbase team. It’s been so hard for me to work with Couchbase in PHP so far. However, I also understand that not that many people use Couchbase with PHP. The big companies you are talking about usually use PHP as a front end language. Most of them use other languages for their backend language. Even xdebug is not completely ready for PHP7.

I also understand that not that many people use Couchbase with PHP

That’s the vicious circle:

  1. No one uses PHP with Couchbase
  2. Couchbase puts non effort into this and the integration is half broken
  3. Someone tries to use PHP with Couchbase
  4. Someone desists due to it being half broken
  5. No one uses PHP with Couchbase - and the ones who tried dropped it

To break this circle Couchbase needs to fix - and properly support - the integration. But this is a long term investment with no inmedate ROI for Couchbase, it’s just a matter of vision and strategy.

It took a decade and a completely change of management for Microsoft to do the same thing with their PHP stuff.

Just reminding that we use PHP with Couchbase.

And one more point. PHP7 is not just the next version, it speeds up the whole thing and possibly solves one of the biggest problems of PHP which is speed. This will probably make PHP a better competitor for the next few years and it would be stupid to stop supporting it now.

We, too, use Couchbase with php, an ETA on php7 support would be very welcomed.

We are a startup founded two years ago which core business is based on BigData and Couchbase (we started from Couchbase 2.0 and nowadays we are using 4.0). We have grown a lot and for both front-end and API we use PHP5.6. It would be very important for us to upgrade to PHP7 (which includes a large set of features which are basic to us) to greatly reduce the response time of our API. Our APPs, in some cases, have a high CPU usage. Please keep us up to date otherwise we’ll have to look for another solution to avoid being slow in our growth.

Best regards,
Travel Appeal Dev Team

2 Likes

We too use Couchbase with PHP. We’re running a quite huge Couchbase cluster but the performance improvements we’ve seen during benchmarks with our code will eventually force us to upgrade our production environment to PHP7. If no ETA on PHP7 compatibility is announced soon, we’ll be forced to look for alternatives to replace our Couchbase cluster.

Stating that not that many users use Couchbase with PHP might be a huge underestimation. Also, only looking at the size of the PHP community shows that there is huge growth potential for Couchbase, especially now PHP7 is released and early-adopters are looking to upgrade/change their setup.

Chiming in as another frustrated developer, who discovered this lack of support at the tail end of upgrading all our systems to PHP7. We really don’t want to have to switch off Couchbase, but that seems like it’s our only option at this point as the php7 branch of the couchbase driver is broken, and there is no communication here about ETAs or priorities =\

1 Like

+1 for PHP7 support. Its really suprising that such “big” and important PHP version is still not supported by Couchbase.

Hi all-- we definitely are working on PHP 7. We appreciate your interest and understanding that doing this update isn’t as simple as we’d like it to be.

On the one hand, we are working on adding a number of features for the upcoming 4.5 release of Couchbase Server. You have probably seen a couple of posts about this. It has new features like Full Text Search and Sub-Document support.

On the other hand, we put some time and effort into PHP 7 shortly after it came out. Where the initial porting looked straightforward, there were more corner cases and unexpected problems that didn’t come out until runtime. Some of those changes make it most efficient to, unfortunately, maintain two different branches of the extension. Software porting can sometimes be like this when the platform changes under you. It’s very hard to estimate and while you really want to get it done, you have a lot to get done and can’t just stop everything for that new platform port.

Work has gone into PHP since I posted on Jan 11. Though I’ve not replied here in the last few weeks, it wasn’t because of lack of work from the team.

If you’d like to help push things along faster, there are a couple of things you can do. One is that you can jump into the branch and help with the porting/testing. It is, after all Open Source under an Apache 2.0 license. Second, is that if you’re an Enterprise subscriber, let your support/account team know so we can get information on the OS Platform and versions, timelines and further prioritize where we put our testing effort.

Hey Guys,

The php7 branch of our code-base will now compile and has been confirmed to correctly execute most operations. Please feel free to take a look, any help with testing is sincerely appreciated.

Cheers, Brett

1 Like

Note there was more work done in the last few days here. It’s not merged yet, but it’s up on our code review system. You can pull it from there if you’d like to let us know how it works out for you.

Hello,

I’ve cloned github repo and tested a simple get/set script, a part of our codebase that uses a counter() and the transcoders.php example.

transcoders.php worked perfectly.

The get/set was basically this:

$cb = new CouchbaseCluster('127.0.0.1:8091');
$bucket = $cb->openBucket('clients');
$r = $bucket->upsert('cb-test-1', 'test-1');
$rr = $bucket->get('cb-test-1');

var_dump($rr);

Here’s what I got:
2 Warnings on the line with upsert(), both were "Warning: Invalid callback , no array or string given in Unknown on line 0"
1 Warning on the line with get(), "Warning: Invalid callback , no array or string given in Unknown on line 0"
The upsert created an empty document with "att_reason": "invalid_json" in the meta.

I tried passing an object and array to to upsert, same result. The only thing that worked was a json string, which did not get decoded by get(), but did save correctly.

I also managed to get rid of the warnings by copying the transcoder related code from the transcoders example.

The counter() code did not work at all. The relevant code is $bucket->counter($resource, 1, ['initial' =>1]), it failed with an exception “The key does not exist on the server”, no document created.

The tests were run on an ubuntu 14.04 vagrant image with cb server version 4.5.0-1308 Enterprise Edition (build-1308).

I tried using the repo @ingenthr specified, but ./configure gives configure: WARNING: unrecognized options: --enable-couchbase and make fails.

Is the latest patchset 6 functional?
http://review.couchbase.org/#/c/62147/6

Looks like the FOREACH_OPCOOKIE_RES macro which was introduced into opcookie.h between patchset 3 and patchset 4 relies on C99, which (at least for me) is not being set as part of the configure / make process:

php-couchbase/opcookie.h:26:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for (Type *Res = NULL; \
     ^
php-couchbase/bucket.c:125:9: note: in expansion of macro 'FOREACH_OPCOOKIE_RES'
         FOREACH_OPCOOKIE_RES(opcookie_get_res, res, cookie) {
         ^
php-couchbase/opcookie.h:26:5: note: use option -std=c99 or -std=gnu99 to compile your code
     for (Type *Res = NULL; \
     ^

Hey @gmot,

Patchset 6 is functional on Mac OS 10.11. I am working on getting my builders working for Windows/Ubuntu/CentOS at the moment. Once these are online, any minor fixes needed for cross-platform compat (such as c99 to c89 fixes) will be done. Sorry for the inconvenience. I hope to have this sorted later today.

Cheers, Brett

Hey @gmot,

Just trying to reproduce that issue you ran into. Any chance you could identify the exact platform you are on, as well as the PHP version you are using?

Cheers, Brett

Hi @brett19

This is Ubuntu 14.0.4, with PHP 7.0.5-2+deb.sury.org~trusty+1

Steps run:

This led to the error mentioned above.

After this, I fired up a clean Ubuntu 14.0 virtual machine, installed php5, cloned the php-couchbase repo, checked out the v2.1.0 tag, configured and built. This was a sanity check to make sure I could build the current GA release with the older php5, and this worked successfully.

Hi @brett19,

I pulled the new patch 8, and can confirm this does indeed build for me with php7.0 under Ubuntu 14.0.
I’ve done some basic gets/sets with Couchbase and at least that much is working well for me.

Thanks for looking into this, and I look forward to seeing it merged into master and published into an official release in the future.

Once you have a times cale for that in place, please do drop back to the forums and let us know, it would be appreciated.

On Archlinux PHP 7.0.5
With master from github and last commit id 48cd3264b0776129f49e72853cd1df532fbdd82f

I can’t compile :
/bin/sh /usr/local/src/php-couchbase/libtool --mode=compile cc -I. -I/usr/local/src/php-couchbase -DPHP_ATOM_INC -I/usr/local/src/php-couchbase/include -I/usr/local/src/php-couchbase/main -I/usr/local/src/php-couchbase -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/php-couchbase/bucket.c -o bucket.lo
cc -I. -I/usr/local/src/php-couchbase -DPHP_ATOM_INC -I/usr/local/src/php-couchbase/include -I/usr/local/src/php-couchbase/main -I/usr/local/src/php-couchbase -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/php-couchbase/bucket.c -fPIC -DPIC -o .libs/bucket.o
In file included from /usr/local/src/php-couchbase/bucket.c:5:0:
/usr/local/src/php-couchbase/paramparser.h: Dans la fonction ‘pcbc_pp_begin’:
/usr/local/src/php-couchbase/paramparser.h:37:52: attention : passing argument 2 of ‘_zend_get_parameters_array_ex’ from incompatible pointer type [-Wincompatible-pointer-types]
if (_zend_get_parameters_array_ex(param_count, args TSRMLS_CC) != SUCCESS) {
^
In file included from /usr/include/php/main/php.h:39:0,
from /usr/local/src/php-couchbase/couchbase.h:11,
from /usr/local/src/php-couchbase/bucket.c:1:
/usr/include/php/Zend/zend_API.h:250:14: note : expected ‘zval * {alias struct _zval_struct *}’ but argument is of type ‘zval *** {alias struct _zval_struct ***}’
ZEND_API int _zend_get_parameters_array_ex(int param_count, zval *argument_array);
^
In file included from /usr/local/src/php-couchbase/bucket.c:5:0:
/usr/local/src/php-couchbase/paramparser.h:115:43: attention : passing argument 2 of ‘zend_hash_find’ from incompatible pointer type [-Wincompatible-pointer-types]
if (zend_hash_find(htoptions, arg->name, strlen(arg->name)+1,

etc…