error when installing pecl memcached
Asked Answered
W

7

12

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...

Wellordered answered 25/6, 2014 at 11:11 Comment(3)
I am getting the exact same problem with libmemcached & memcached.h. I am digging into it & will update if I figure it out. Please update if you find a solution.Steven
I tried to install 1.0.16 of libmemcached to use with php-memcached-2.1 but had errors building libmemcached ;-) I'm still googling and fiddling, ill let you know. Or I'll use redis :-DWellordered
Although I have installed Memcached successfully ( what errors are you getting when building libmemcached ? ), even I am going for Redis - as in my use case, I want to cache objects, Session storage which will be sharing between different applications. Memcached cannot be used for Session storage ( not atleast without a twisted approach ), hence redis it is \m/Steven
S
14

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.

Steven answered 26/6, 2014 at 14:41 Comment(2)
I haven't tried this but I'll take your word for it in case someone finds this as everything I've read suggests it's correct. It was just my specific issue building libmemcached prevented me from testingWellordered
Yes, it works. If it does not work for YOU check if you don't have libmemcached 1.1.16+ installed instead of libmemcached 1.0.16+.Genic
T
20

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

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

Treacle answered 13/2, 2015 at 12:35 Comment(1)
this did the trick, without going through any loopholes or having to download and compile specific packages or versions from sourceSystematism
S
14

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.

Steven answered 26/6, 2014 at 14:41 Comment(2)
I haven't tried this but I'll take your word for it in case someone finds this as everything I've read suggests it's correct. It was just my specific issue building libmemcached prevented me from testingWellordered
Yes, it works. If it does not work for YOU check if you don't have libmemcached 1.1.16+ installed instead of libmemcached 1.0.16+.Genic
A
9

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)

Ammonite answered 17/6, 2015 at 17:34 Comment(0)
T
2

If you dont need sasl support here is an easy way to install 2.2.X:

pecl_memcached_ver="2.2.0"
pecl download memcached-${pecl_memcached_ver}
tar xzvf memcached-${pecl_memcached_ver}.tgz
cd memcached-${pecl_memcached_ver}/
phpize
./configure --disable-memcached-sasl
make
make install
cd ..
rm -r memcached-${pecl_memcached_ver}
echo "extension=memcached.so" > /etc/php5/fpm/conf.d/20-memcached.ini

Then run php5 -i to test that it installed 2.2.x correctly

Turki answered 22/7, 2014 at 16:21 Comment(0)
Z
1

Steps:

  1. sudo apt-get install libmemcached libmemcached-dev
  2. sudo mkdir -p /usr/lib/x86_64-linux-gnu/include/libmemcached && sudo ln -s /usr/include/libmemcached/memcached.h /usr/lib/x86_64-linux-gnu/include/libmemcached/memcached.h
  3. echo "/usr/lib/x86_64-linux-gnu --disable-memcached-sasl" | sudo /opt/phpfarm/inst/php-5.4.40/bin/pecl -C /opt/phpfarm/inst/php-5.4.40/etc/pear.conf install memcached

Setup: Ubuntu 14.04.x LTS x64 (trusty tahr) phpfarm (latest) with pecl PHP 5.4.40 memcached 2.2.0

NOTE: Obviously, you must replace the paths according to your system

Zack answered 25/4, 2015 at 18:47 Comment(0)
M
0

The procedure @rynop is very good and its all great!

Now how about you want to package for deployment? My target deployment runs on Ubuntu 14.04 LTS and I want it to replace upstream php5-memcached package as a simple .deb file.

For this, take a look at fpm which stands for "Freaking Package Manager" (sic). Its made to create packages out of almost anything.

After @rynop procedure, here’s what I did:

// Rest of @rynop procedure, modulo this configure options
./configure --enable-memcached-igbinary --disable-memcached-sasl

Install jordansissel/fpm

apt-get install -y pkg-config ruby-dev gcc
gem install fpm

Then, check the package contents you want to replace and let’s replicate for our own purposes.

dpkg --list | grep php5-memcached
find /var/cache/apt -type f -name '*php5-memcached*'
dpkg -c /var/cache/apt/archives/php5-memcached_2.1.0-6build1_amd64.deb

I figured out in the output that I only needed a few folders, so I created them.

mkdir -p etc/php5/mods-available/
// Adjust memcached.ini to suit your tastes, then prepare it for packaging
cp memcached.ini etc/php5/mods-available/
// Make sure the usr/lib/php5/foo path matches in 
// the result of `dpkg -c` you issued
mkdir -p usr/lib/php5/20121212/
cp modules/memcached.so usr/lib/php5/20121212/

Magic will happen

fpm -s dir -t deb -n php5-memcached -v 2.2.0-wpd -m '<[email protected]>' --description 'PHP 5.5 PECL igbinary + memcached support' -d libmemcached10 etc/ usr/
Marciano answered 19/2, 2015 at 1:25 Comment(0)
P
0

On CentOS 7.2 with installed libmemcached-devel version 1.0.16 you should answer the question with /usr:

libmemcached directory [no] : /usr

Parka answered 14/12, 2017 at 9:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.