Can't install couchbase 1.0 beta php sdk
Running PHP 5.3.8 on Fedora 15 32 bit
1. Copied the centos 5.5 32bit (red hat and fedora compatible) couchbase.so file to my php modules directory
2. added an .ini in my /etc/php.d/ directory that contains extension=couchbase.so
3. restarted php
4. ran basic test code and get Fatal error: Class 'Couchbase' not found in /home/luckyorange/public_html/test_couch.php on line 5
The .ini file is being read according to phpinfo() and the couchbase.so file is in the same directory as all the other modules that are read fine.
Any ideas?
why would I need to do that if I put the couchbase.so file into my extensions directory?
extension_dir /usr/lib/php/modules
I put it in there. Should it ready that regardless of the include_path?
looking at my logs further I see this:
PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/couchbase.so' - libcouchbase.so.1: cannot open shared object file: No such file or directory in Unknown on line 0
where does libcouchbase.so.1 come from??
okay, I'm getting closer,
I didn't see the note that said the C Client library was required from this page:
http://www.couchbase.com/develop/c/current
So I download libvbucket and libcouchbase and got further, but now I get this error:
PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/couchbase.so' - /usr/lib/php/modules/couchbase.so: undefined symbol: php_json_encode in Unknown on line 0
I'm on php 5.3.8.
Noone else is having an issue with this??
Yes, libcouchbase and libvbucket are required, sorry I didn't catch you were missing that.
I think it's that you need the json.so extension listed before this extension. At least, that's what I found here:
https://bugs.php.net/bug.php?id=59267
I found a couple of other results in searching for that error message too. None of them seem to directly be related to something wrong in the client, just the order in which PHP will dlopen the extensions.
Which platform are you on? If you post your full php.ini, we can probably try it.
(p.s.: missed you in IRC just now)
Okay, getting closer again :) that helped somewhat, but now I get this:
Couchbase::__construct(): failed to create IO instance
I gave up but managed to get the php 1.1 sdk running (http://www.couchbase.com/develop/php/next)
So, I'll just use that :)
I'm having a similar issue:
Starting php-fpm PHP Warning: PHP Startup: Unable to load dynamic library '/opt/php-ext-couchbase/couchbase.so' - /opt/php-ext-couchbase/couchbase.so: undefined symbol: executor_globals in Unknown on line 0
done
I tried the input path as suggested above but that didn't seem to help
include_path=/opt/php-ext-couchbase
I have all of the c libraries installed successfully as far as I can tell.
Hi eric,
Which version of PHP are you using?
Cheers
Jan
--
PHP 5.3.6
Might have missed if there were version issues in the docs. Thanks for pointing me in the right direction if I did.
Hi,
> I gave up but managed to get the php 1.1 sdk running (http://www.couchbase.com/develop/php/next)
> So, I'll just use that :)
The 1.1. SDK is due to be rebased on 1.0 and you'll get back to square one here :)
Towards the earlier posts in this thread: include_path has nothing to do with php extensions, but only refers to the include() and require() function families to including native PHP code.
the two configure options extension_dir and extension allow you to specify where your PHP extensions live. You can place an extension into extension_dir and then enable it using extension=couchbase.so or you can use extension=/full/path/to/couchbase.so.
Now that you have gotten to `new Couchbase()`, but you are getting an error. Can you paste your exact line that include the `new Couchbase()` and its arguments? and can you double check they are all correct?
e.g. it could look like this:
$cb = new Couchbase("localhost:8091", "username", "password", "default");
Cheers
Jan
--
Hi Eric,
hmmm, like I wrote in the other post, include_path is irrelevant here. Also, it looks like PHP attempts to open the correct file (/opt/php-ext-couchbase/couchbase.so)
executer_globals is something that has been in PHP since about forever, so it's weird that it shows up here.
Nothing points at missing c libraries either.
Are you by chance trying to run our 32bit download on a 64bit system (or at least on a 64bit PHP)?
Can you paste the result of these two commands?
$ file /opt/php-ext-couchbase/couchbase.so
$ file `which php`
Cheers
Jan
--
Here's a detailed list of the process for install. Hopefully this helps.
rpm -ivh libvbucket1-1.8.0.1-1.x86_64.rpm
wget http://packages.couchbase.com/clients/c/libvbucket1-1.8.0.1-1.x86_64.rpm
wget http://packages.couchbase.com/clients/c/libcouchbase1-1.0.0-1.x86_64.rpm
wget http://packages.couchbase.com/clients/c/libcouchbase-devel-1.0.0-1.x86_6...
wget http://packages.couchbase.com.s3.amazonaws.com/clients/c/libcouchbase-de...
rpm -ivh libcouchbase1-1.0.0-1.x86_64.rpm
rpm -ivh libcouchbase-devel-1.0.0-1.x86_64.rpm
Install PHP Extension
wget http://packages.couchbase.com/clients/php/php-ext-couchbase-1.0.0-beta-c...
tar xvzf php-ext-couchbase-1.0.0-beta-centos-x86_64.tar.gz
mv php-ext-couchbase /opt
vim /etc/php.ini
Update with >> extension=/opt/php-ext-couchbase/couchbase.so
service php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm PHP Warning: PHP Startup: Unable to load dynamic library '/opt/php-ext-couchbase/couchbase.so' - /opt/php-ext-couchbase/couchbase.so: undefined symbol: executor_globals in Unknown on line 0
done
file /opt/php-ext-couchbase/couchbase.so
/opt/php-ext-couchbase/couchbase.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
file `which php`
/usr/local/bin/php: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
Hi Eric,
thanks, that's great info. It looks indeed that all should be fine. Can you check whether you are running into this issue:
https://bugs.php.net/bug.php?id=24853 (It's an old report, don't worry about that :)
i.e. does your PHP's ./configure line include --enable-versioning?
You can find out by looking at <? phpinfo(); ?>
Cheers
Jan
--
Here's what the server info:
Configure Command => './configure' '--with-libdir=lib64' '--with-openssl' '--with-mysql' '--with-mysqli' '--with-pdo-mysql' '--with-gd' '--enable-fpm' '--with-mcrypt' '--with-pic' '--enable-mbstring' '--with-curl' '--disable-debug' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-zlib' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-pcntl' '--enable-mbregex' '--with-mhash' '--with-xsl' '--enable-zip' '--with-pcre-regex' '--with-config-file-path=/etc/' '--enable-maintainer-zts' '--with-layout=GNU' '--with-freetype-dir=/usr' '--enable-gd-native-ttf' '--with-gettext'
Can you take out --enable-maintainer-zts?
Cheers
Jan
--
Let me know if I should take this offline so as not to clog everyone's inbox:
php ./configure '--with-libdir=lib64' '--with-openssl' '--with-mysql' '--with-mysqli' '--with-pdo-mysql' '--with-gd' '--enable-fpm' '--with-mcrypt' '--with-pic' '--enable-mbstring' '--with-curl' '--disable-debug' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-zlib' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-pcntl' '--enable-mbregex' '--with-mhash' '--with-xsl' '--enable-zip' '--with-pcre-regex' '--with-config-file-path=/etc/' '--with-layout=GNU' '--with-freetype-dir=/usr' '--enable-gd-native-ttf' '--with-gettext'Failed loading /usr/local/lib/php/20090626-zts/eaccelerator.so: /usr/local/lib/php/20090626-zts/eaccelerator.so: undefined symbol: core_globals_id
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/memcached.so' - /usr/lib64/php/modules/memcached.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/opt/php-ext-couchbase/couchbase.so' - /opt/php-ext-couchbase/couchbase.so: undefined symbol: php_json_encode in Unknown on line 0
Could not open input file: ./configure
This is fine :)
You are trying to pass the configure line as an argument to PHP, that won't work :)
When you build PHP, you need to run the configure line (without the --enable-maintainer-zts option) in PHP's source directory.
Aside, seeing that you do run PHP, there's more warnings about other extensions. It is best to resolve these issues as well before attempting to fix this one :)
Cheers
Jan
--
I encountered the exact same error when trying to enable couchbase.so: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/couchbase.so' - /usr/lib64/php/modules/couchbase.so: undefined symbol: php_json_encode in Unknown on line 0
I'm using PHP 5.3.10
The configuration for PHP: './configure' '--build=x86_64-unknown-linux-gnu' '--host=x86_64-unknown-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--enable-gd-native-ttf' '--with-t1lib=/usr' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar' '--with-libxml-dir=/usr' '--enable-xml' '--with-system-tzdata' '--with-mhash' '--with-apxs2=/usr/sbin/apxs' '--libdir=/usr/lib64/php' '--enable-pdo=shared' '--with-mysql=shared,/usr' '--with-mysqli=shared,/usr/lib64/mysql/mysql_config' '--with-pdo-mysql=shared,/usr/lib64/mysql/mysql_config' '--with-pdo-sqlite=shared,/usr' '--without-gd' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-xmlreader' '--disable-xmlwriter' '--without-sqlite' '--without-sqlite3' '--disable-phar' '--disable-fileinfo' '--disable-json' '--without-pspell' '--disable-wddx' '--without-curl' '--disable-posix' '--disable-sysvmsg' '--disable-sysvshm' '--disable-sysvsem'
Hopefully some one could help me with these problem :(
Thanks a ton :)
Hi,
thanks for your report. As it turns out, your error message is a little different. I noticed you have --disable-json in your configure line. Can you replace that with --enable-json?
Cheers
Jan
--
Hi all,
I have running Couchbase 1.8 run on CentOS 6.2 x64 with PHP 5.3.3
When install the php sdk i have the error like this
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/couchbase.so' - /usr/lib64/php/modules/couchbase.so: undefined symbol: php_json_encode in Unknown on line 0
I try to Google this and try serveral ways but can not fix this error?Anyone have the same error can tell me how to fix ?
Can you recompile your php with --enable-json? or install the php-json package for your distribution?
Same result :((
The json extension is enabled when i do php -i
but does the ./configure line still include --disable-json? In that case I believe, the main PHP binary needs recompiling with --enable-json.
Thanks, that solved the problem :)
Finally i have PHP 5.3.10 with --enable-json on my ./configure
./configure '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--enable-gd-native-ttf' '--with-t1lib=/usr' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar' '--with-libxml-dir=/usr' '--enable-xml' '--with-system-tzdata' '--with-mime-magic=/usr/share/file/magic' '--with-apxs2=/usr/sbin/apxs' '--enable-soap' '--with-gd' '--enable-dom' '--disable-dba' '--without-unixODBC' '--enable-pdo' '--enable-xmlreader' '--enable-xmlwriter' '--without-sqlite' '--enable-json' '--without-pspell' '--enable-wddx' '--with-curl' '--enable-mbstring=all' '--disable-posix' '--disable-sysvmsg' '--disable-sysvshm' '--disable-sysvsem' '--with-mcrypt' '--with-mhash' '--with-mysql' '--enable-mysqli' '--with-mysqli=/usr/bin/mysql_config' '--with-pdo-mysql=/usr/bin/mysql_config' '--with-xsl' '--with-zip'
Next i add the to my php.ini extension=/opt/php-ext-couchbase/couchbase.so
Make a test file name test.php like on http://www.couchbase.com/develop/php/current
My test.php
<?php
$cb = new Couchbase("127.0.0.1:8091", "myuser","mypass", "default");
$cb->set("a", 1);
var_dump($cb->get("a"));
?>When i run it via console like
php test.php it have error Segmentation fault

This image on my phpinfo()
Please help me next :D .Anyway thank for all supports
My test server : CentOS 5.5 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:14 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
PHP 5.3.10 (cli) (built: Feb 22 2012 15:18:53) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
Woot, congrats all! :)
How about the Segment fault ?
I also get a segmentation fault:
This appears in syslog:
kernel: [2676122.199129] php[27622]: segfault at 7c ip 00007f9e8090c027 sp 00007fffa7aef680 error 4 in libevent-1.4.so.2.1.3[7f9e80907000+18000]
It'seem still bugs on this release :D cause it's beta release.Waiting. for next version.
Hey all, a new release is coming up real soon and we fixed a great number of things, so stay tuned :)
Chad, would it be possible to get a backtrace from you on that crasher?
I'm having the same problem.
I'm on Debian squeeze (installed on rack space).
I installed the client by doing:
apt-get install libevent-dev
dkpg -i libvbucket1_1.8.0.2-1_amd64.deb
dpkg -i libcouchbase1_1.0.1-1_amd64.deb
And then using the couchbase.so via PHP5. I have the same result with the same test code causing the segmentation fault.
Sadly, we developed on our test server running 1.7 membase. But I cannot seem to find a link to the memcached.so for PHP we also used. Is there a link to the old PHP extension so I can use that instead of couchbase.so? The new version looks cool, but I don't have the luxury of waiting for a fix. Plus its obviously not ready for prime time. There should still be links to stable code for those of us who need that right now.
We fixed a good amount of bugs for the next release which should drop any day now.
If you feel like building form source, you can track our process at https://github.com/couchbase/php-ext-couchbase
the old version is http://pecl.php.net/package/memcached
you can normally install it with just "pecl install memcached"
note the d is important.. there is another pecl extension without the d that is (i think) considered deprecated.
Thanks Chad for jumping in here, I totally didn't see the second part of that question, but I spent all day in DocBook, so excuse me :)
I believe ext/memcache is as alive as ext/memcached, but we'd recommend ext/memcached (the one with the d :) until the new ext/couchbase drops :)
I think out-of-the-box the memcache extension uses different flags to indicate compressed values than does the memcached extension (although it's been a while since the I used the memcache one so I could be wrong). Are there any other known incompatibilities?
Thanks all. I grabbed memcached and stuck moxi on my app servers and it looks like its working fine. They are talking to the couch base 1.8 server. No problems so far. A day of testing by our team will verify.
Hey everybody,
thanks for hanging in there, we finally shipped the 1.0.0 GA of the PHP SDK: http://www.couchbase.com/develop/php/current
Thanks for all your reports and patience of the past few weeks. We hope we have resolved all issues you might have had, but if you find more, do not hesitate to report them here or in the issue tracker: http://couchbase.com/issues/browse/PCBC
Cheers
Jan
--
Finally the PHP SDK is work on my development server.Thank for your support.
php couchbase.php int(1)
Make sure to install the C client first [http://www.couchbase.com/develop/c/current]
Just to close out on this thread, the issue ericbrown and assafkar was running into seems to be related to that particular PHP environment. We're not quite sure why, but it refused to load shared objects.
In case anyone else runs into the same issue, it'd be best to review the PHP environment first. Extensions built as shared modules should load.
If you have to, for some reason, keep this environment, can't get shared modules to load and need to rebuild the extension, it's still possible. Process is:
1) get the archive files for libvbucket and libcouchbase, either from development packages or building from source
2) build the PHP extension from source
--- building everything ---
git clone git://github.com/membase/libvbucket.git
cd libvbucket
./config/autorun.sh
./configure --prefix=/opt/couchbase.git
make
sudo make install
git clone git://github.com/couchbase/libcouchbase.git
cd libcouchbase
git checkout release10
./config/autorun.sh
export CPPFLAGS='-I/opt/couchbase.git/include'
export LDFLAGS='-L/opt/couchbase.git/lib'
./configure --prefix=/opt/couchbase.git
make
sudo make install
git clone git://github.com/couchbase/php-ext-couchbase.git
cd php-ext-couchbase/
phpize
./configure --with-couchbase=/opt/couchbase.git
make
sudo make install
--- adding devel packages to get .la archives ---
# add /etc/yum.repos.d/couchbase.repo
[couchbase]
name = Couchbase package repository
baseurl = http://packages.couchbase.com/rpm/5.5/x86_64
sudo yum check-update
sudo yum install --nogpgcheck libvbucket-devel libcouchbase-devel
git clone git://github.com/couchbase/php-ext-couchbase.git
cd php-ext-couchbase/
phpize
./configure
make
sudo make install
Couchbase::__construct(): failed to create IO instance
I am having this same issue for 1.1
It looks like you'll need to add to the include path in php.ini.
Something like
include_path=/path/to/couchbae/php-couchbase-memcached
extension=/path/to/couchbase/php-couchbase-memcached/memcached.so
in your php.ini. This will need to be adjusted for the current release.
Sorry about the docs not covering it. We'll get that fixed up.