Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error when installing pecl memcached

I've been having real trouble installing the pecl memcached package.

Have not had any joy with any yum or pear/pecl install commands I referred to this question Install PECL Memcached Error and started trying to configure/make manually

I'm using pecl to download the latest (memcached-2.2.0) then untar, phpize...

If I configure with --disable-memcached-sasl the configure completes but make fails. With what looks like syntax errors

In file included from /root/memcached-2.2.0/php_memcached_private.h:28,
                 from /root/memcached-2.2.0/php_memcached.c:26:
/root/memcached-2.2.0/php_libmemcached_compat.h:56: error: expected ‘=’, ‘,’, ‘;’, ‘asm’     or ‘__attribute__’ before ‘php_memcached_instance_st’
/root/memcached-2.2.0/php_memcached.c:328: error: expected declaration specifiers or ‘...’ before ‘php_memcached_instance_st’
/root/memcached-2.2.0/php_memcached.c:329: error: expected declaration specifiers or     ‘...’ before ‘php_memcached_instance_st’
/root/memcached-2.2.0/php_memcached.c:330: error: expected declaration specifiers or ‘...’ before ‘php_memcached_instance_st’
/root/memcached-2.2.0/php_memcached.c: In function ‘php_memc_get_impl’:
/root/memcached-2.2.0/php_memcached.c:594: warning: passing argument 4 of     ‘memcached_mget_by_key’ from incompatible pointer type
/usr/include/libmemcached/memcached_get.h:38: note: expected ‘char **’ but argument is of type ‘const char **’
/root/memcached-2.2.0/php_memcached.c: In function ‘php_memc_getMulti_impl’:

There's more of that but hopefully thats a useful enough indicator

If I use --with-libmemcached-dir=/usr/include/libmemcached i get

checking for libmemcached location... configure: error: Unable to find memcached.h under /usr/include/libmemcached

But that IS where memcached.h is

If I use --with-libmemcached-dir=no configure gives

configure: error: no, libmemcached sasl support is not enabled. Run configure with --disable-memcached-sasl to disable this check

If i add the --disable-memcached-sasl option, it configure completes but make fails with the syntax errors again

Feel like I'm stuck in a loop.

This isn't the first time I've set up a server from scratch to use memcached (although first time in a while I guess) I don't remember having any issues before.

Any ideas please anyone?

This looked like a good lead

http://blusmurf.net/2012/08/27/pecl-memcache-build-error/

But not joy still

I've also been investigating this issue from php-memcached's github page

https://github.com/php-memcached-dev/php-memcached/issues/69

I've tried with 2.1 and 2.2 now, hacking the files to try and get make to build. Still no luck...

like image 709
joevallender Avatar asked Jun 25 '14 11:06

joevallender


3 Answers

Step 1 - Install SASL:

yum install cyrus-sasl-devel

Step 2 - Compile libmemcached with SASL installed:

cd ~
wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
tar -zxvf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure
make && make install

Step 3 - Install PHP Memcached:

pecl install memcached

(Do not specify libmemcached-dir)

like image 77
slightlyfaulty Avatar answered Nov 22 '22 22:11

slightlyfaulty


Solved it by using this combination:

  1. libmemcached release 1.0.16 - installed from source
  2. php-memcached release 2.1.0 - installed from source & Added memcached.so in php.in

I Hope this help.

like image 37
flyankur Avatar answered Nov 22 '22 23:11

flyankur


If you don't need SASL, answer with this:

libmemcached directory [no] : no --disable-memcached-sasl

like image 24
Tom Mettam Avatar answered Nov 22 '22 23:11

Tom Mettam