Reputation: 4293
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...
Upvotes: 12
Views: 28285
Reputation: 81
On CentOS 7.2 with installed libmemcached-devel version 1.0.16 you should answer the question with /usr:
libmemcached directory [no] : /usr
Upvotes: 0
Reputation: 1411
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
)
Upvotes: 9
Reputation: 11
Steps:
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
Upvotes: 1
Reputation: 559
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/
Upvotes: 0
Reputation: 2963
If you don't need SASL, answer with this:
libmemcached directory [no] : no --disable-memcached-sasl
Upvotes: 20
Reputation: 53499
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
Upvotes: 2
Reputation: 354
Solved it by using this combination:
I Hope this help.
Upvotes: 14