Configure error memcached support requires libmemcached

Stuck with "Error memcached support requires libmemcached"? we can help you.Often while trying to install memcached we may end up with this error

Stuck with “Error memcached support requires libmemcached”? we can help you.

Often while trying to install memcached we may end up with this error. This error is common for both Plesk and cPanel.

Here at Bobcares, we often handle requests from our customers to fix similar errors as a part of our Server Management Services. Today we will see how our support engineers fix this for our customers.

Causes and Fixes for “Error memcached support requires libmemcached”

We will see what causes this error in Plesk as well as cPanel servers along with their fixes.

Plesk

The error typically looks like the following one in Plesk servers:

Error memcached support requires libmemcached

Cause

The libmemcached-devel package missing.

Steps to fix this error

Following are the steps to fix this error in the Plesk server.

1. First log in to the server via SSH.

2. Then use the following command to install the package depending upon the operating system(OS):

RHEL/CentOS/CloudLinux:

# yum install libmemcached-devel

Ubuntu/Debian:

# apt-get install libmemcached-dev

cPanel 

The error typically looks like the following one in cPanel servers:

If Installing memcached from WHM » Software » Module Installers was not successful it triggers the error. A typical error may look like the one given below.

Error memcached support requires libmemcached

The exact steps for the installation given below:

1.Run the following commands:

wget https://github.com/downloads/libevent/libevent/libevent-2.0.17-stable.tar.gz --no-check-certificate

tar -xvf libevent-2.0.17-stable.tar.gz 

cd libevent-2.0.17-stable

./configure

make && make install

cd ~

wget http://memcached.googlecode.com/files/memcached-1.4.13.tar.gz

tar -xzf memcached-1.4.13.tar.gz

cd memcached-1.4.13

./configure

make && make install

2. After installing these components we have to create the following file:

For 32-bit machine

echo "/usr/local/lib/" > /etc/ld.so.conf.d/libevent-i386.conf

For 64-bit machine

echo "/usr/local/lib/" > /etc/ld.so.conf.d/libevent-x86_64.conf

3. Then Run the following commands:

ldconfig
memcached -d -u nobody -m 1024 127.0.0.1 -p 11211

4. Next, we can install libsasl2 using the following command:

yum install cyrus-sasl-devel

5. Then we will install libmemcached using the following command:

cd ~

wget http://launchpad.net/libmemcached/1.0/1.0.4/+download/libmemcached-1.0.4.tar.gz

tar -zxvf libmemcached-1.0.4.tar.gz

cd libmemcached-1.0.4

./configure

make && make install

pecl install memcached

6. Now we can run the following to check if memcached.so is installed into /usr/local/lib/php.ini file. We can add it if is it not.

grep -q "memcached.so" /usr/local/lib/php.ini || echo 'extension=memcached.so' >> /usr/local/lib/php.ini

7. We can check the extension directory that we are using, with the following command:

for i in `grep ^extension_dir /usr/local/lib/php.ini | awk {'print $3'} | cut -d" -f2` ;do ls -lah $i/memcache* ;done

8. Also, to preserve the memcached.so module on EasyApache recompiles we have to do the following:

for i in `grep ^extension_dir /usr/local/lib/php.ini | awk {'print $3'} | cut -d" -f2` ;do cp $i/memcached.so /root ;done
for i in `grep ^extension_dir /usr/local/lib/php.ini | awk {'print $3'} | cut -d" -f2` ;do echo -e '#!/bin/bashncp /root/memcached.so' "$ingrep -q 'memcached.so' /usr/local/lib/php.ini || echo 'extension=memcached.so' >> /usr/local/lib/php.inin/etc/init.d/httpd restart" > /usr/local/cpanel/scripts/posteasyapache ;done
chmod +x /usr/local/cpanel/scripts/posteasyapache

This will create a posteasyapache script that will ensure memcached.so is copied from /root/memcached.so back into the php extension directory.

9. Finally using the following commands we can ensure that the installation was done properly and is complete.

root@host [~]# php -i | grep -i memcached
memcached
memcached support => enabled
libmemcached version => 1.0.4
Registered save handlers => files user sqlite memcached

[Still, stuck with the error? We can help you]

Conclusion

In short, we saw how our Support Techs fix “error memcached support requires libmemcached” for our customers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

Peter,

I am aware of this, perhaps this thread was the wrong choice (based on the opening post), but it seems that Michael-Inet diverted the thread away to an alternative issue. I however, found this thread by googling the error listed by Michael-Inet, of which I have the exact same issue, and have follwed the exact same steps.

«checking for sasl/sasl.h… no
configure: error: no, sasl.h is not available. Run configure with —disable-memcached-sasl to disable this check
ERROR: `/root/tmp/pear/memcached/configure —with-libmemcached-dir=no’ failed»

Michael,

I have run through all of the steps in Tristan’s post in this thread (https://forums.cpanel.net/threads/memcached-instalation-memcached-so-missing.257942/)

I had no problems downloading, and compiling libevent or memcached (the apache version)

I had no problems creating the 64bit libevent file

I had no problems running ldconfig and starting the memcached server

Installing and building libmemcached went fine.

The only differences between Tristan’s post, and what I downloaded/compiled/installed was the versions of the software, I obviously used the most recent versions, rather than the versions that were recent back in feb 2012).

The issue is when installing the PHP Memcached PECL plugin via the «pecl install memcached» command, or using the PECL GUI in WHM.

When I do this, I get the error relating to SASL.

I have installed Cyrus-Sasl-Devel through yum, as suggested in your reply to Michael-Inet, but this has not resolved the issue.

The SASL error still occurs when attempting to install the PECL memcached classes and functions for PHP.

…… oooh! ……

Actually the SASL error is different now.

It’s found sasl.h but notes that libmemcached was built without sasl support

«checking whether libmemcached supports sasl… no
configure: error: no, libmemcached sasl support is not enabled. Run configure with —disable-memcached-sasl to disable this check
ERROR: `/root/tmp/pear/memcached/configure —with-libmemcached-dir=no’ failed»

I’ve actually resolved the problem.

Cyrus-sasl-devel needs to be installed before libmemcached is compiled.

running

#cd /path/to/libmemcached src
#make uninstall
#./configure
#make && make install
#pecl install memcached

works for me

Tristans post should be updated to require the installation of SASL prior to the installation of libmemcached

e.g.

Next, install libsasl2

Code:

yum install cyrus-sasl-devel

Now, install libmemcached:

Code:

cd ~
wget http://launchpad.net/libmemcached/1.0/1.0.4/+download/libmemcached-1.0.4.tar.gz
tar -zxvf libmemcached-1.0.4.tar.gz
cd libmemcached-1.0.4
./configure
make && make install
pecl install memcached

[edit] I also made a post about this in the thread with Tristan’s installation guide

Common php compile errors and the corresponding missing lib

Some of the package only available if you have set up epel for additional yum repo.

configure: error: Please reinstall the sqlite distribution from http://www.sqlite.org
$ yum install sqlite-devel.x86_64

configure: error: freetype-config not found.
$ yum install freetype-devel.x86_64 freetype.x86_64

configure: error: libXpm.(a|so) not found.
$ yum install libXpm-devel.x86_64 libXpm.x86_64

configure: error: jpeglib.h not found.
$ yum install libjpeg-devel.x86_64
or for centOS 6.x
$ yum install libjpeg-turbo.x86_64 libjpeg-turbo-devel.x86_64

configure: error: png.h not found.
$ yum install libpng-devel.x86_64

configure: error: Unable to locate gmp.h
$ yum install gmp-devel.x86_64

configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
$ yum install libc-client-devel.x86_64

configure: WARNING: continuing without libevent support
$ yum install libevent-devel.x86_64

configure: error: Cannot find imap library (libc-client.a). Please check your c-client installation.
# you may find that you have the lic-client-devel.x86_64 installed but configure still complains, and it seems, we need
# the i686 version. or we can use –with-libdir=lib64 without install the i686 package
$ yum install libc-client-devel.i686

configure: error: Kerberos libraries not found.
# you find you have the 64bits version installed, but configure still complains
# install the i686 version too or we can use –with-libdir=lib64 without install the i686 package
$ yum install krb5-devel.i686

configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
$ yum install libicu-devel.x86_64

configure: error: installation or configuration problem: C++ compiler cannot create executables.
$ yum install gcc-c++.x86_64

configure: error: Cannot find ldap.h
$ yum install openldap-devel.x86_64

configure: error: Cannot find ldap libraries in /usr/lib.
# on our 64 bits system, it needs something still in /usr/lib
# or we can use –with-libdir=lib64 without install the i686 package
$ yum install openldap-devel.i686

configure: error: mcrypt.h not found. Please reinstall libmcrypt.
$ yum install libmcrypt-devel.x86_64

mysql_config not found
# find out where mysql_config is and add –with-mysqli=/usr/bin/mysql_config

configure: error: Cannot find pspell
$ yum install aspell-devel.x86_64

configure: error: Cannot find libtidy
$ yum install libtidy-devel.x86_64

configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
$ yum install libxslt-devel.x86_64

configure: error: Please reinstall the BZip2 distribution
$ yum install bzip2-devel.x86_64

configure: error: Cannot find libsphinxclient headers

configure: error: xml2-config not found. Please check your libxml2 installation.
$ yum install libxml2-devel.x86_64

configure: error: Cannot find OpenSSL’s
$ yum install openssl-devel.x86_64

checking for PCRE headers location… configure: error: Could not find pcre.h in /usr
$ yum install pcre-devel.x86_64

configure: error: Please reinstall the libcurl distribution –
easy.h should be in /include/curl/

$ yum install libcurl-devel.x86_64

configure: error: Unable to detect ICU prefix or shared,/usr/bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works.
$ yum install icu.x86_64 libicu-devel.x86_64

configure: error: C++ preprocessor “/lib/cpp” fails sanity check
$ yum install gcc-c++.x86_64

checking for libmemcached location… configure: error: memcached support requires libmemcached. Use –with-libmemcached-dir=xxx to specify the prefix where libmemcached headers and library are located
$ yum install libmemcached.x86_64
and add “–with-libmemcached-dir=/usr” to configure cmd

checking for libmemcached location… configure: error: Unable to find memcached.h under /usr
$ yum install libmemcached-devel.x86_64

configure: error: no, libmemcached sasl support is not enabled. Run configure with –disable-memcached-sasl to disable this check
fix: let us go without SASL support by adding “–disable-memcached-sasl”
later we could build a memcached with SASL enabled and revisit this issue

configure: error: Cannot find enchant
$ yum install enchant.x86_64 enchant-devel.x86_64 enchant-aspell.x86_64

configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!
fix:
$ yum install mysql-libs.x86_64 mysql-devel.x86_64

configure: error: mysql configure failed. Please check config.log for more information.
conftest.c:36: undefined reference to `pthread_mutexattr_init’
conftest.c:37: undefined reference to `pthread_create’
fix:
This issue is similar the issue above. however in our case, we are using mysql.com latest mysql 5.6.22 RPM and there are something broken in
our env. and our fix is to build php 5.4.36 with the yum mysql client lib and dev lib.

configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
$ yum install postgresql-libs.x86_64 postgresql-devel.x86_64

checking for sqlite3 files in default path… not found
configure: error: Please reinstall the sqlite3 distribution
$ yum install sqlite-devel.x86_64

configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.
$ yum install net-snmp-devel.x86_64 net-snmp-libs.x86_64

configure: error: Please install pecl/raphf and activate extension=raphf.so in your php.ini
$ yum install php-pecl-raphf-devel.x86_64 php-pecl-propro-devel.x86_64
still can not compile. we may have to leave pecl_http for later using pecl?

configure: WARNING: unrecognized options: –enable-magic-quotes, –with-sqlite
fix: these are no longer valid for php 5.4+, just remove these options.

ext/pecl_http/config.m4:5: warning: file `config9.m4′ included several times
fix: rename it to “http” which is the official ext name, though the downloaded ext file name is pecl_http

Installing Memcached or LSMCD and PHP Memcached Extention

To use object cache, you can install Memcached, or LiteSpeed’s version of Memcached, LSMCD. To work with Memcached or LSMCD memory cache daemon, you will also need to enable the php memcached extention. This wiki will explain how to install/verify Memcached or LSMCD daemon, and also how to install/verify PHP PECL Memcached extention for your environment.

Install LiteSpeed Memcached

LSMCD is a high-performance, distributed caching system with file-backed shared memory. It’s generic in nature, but was originally intended for use in speeding up dynamic web applications by alleviating database load. It is designed as a drop-in replacement for Memcached, however we also have a few features that Memcached does not: High Availability and persistence of data. High Availability means that if one or more of your servers goes down, your data can still be accessed and updated as though it was still up. Persistence of data means that there is no need for a database backend. Whatever you put in LSMCD stays in LSMCD unless you say otherwise.

To install LiteSpeed Memcached, please see Compiling/Installing LSMCD.

Install Memcached

for Centos7

yum install memcached -y

systemctl start memcached

systemctl enable memcached

For Ubuntu/Debian

apt-get install memcached

systemctl start memcached

systemctl enable memcached

Verify Memcached or LSMCD Daemon

telnet 127.0.0.1 11211

stats

For Plesk Centos7:

PHP7.0/7.1/7.2

yum install -y make plesk-php70-devel plesk-php71-develgcc plesk-php72-devel glibc-devel libmemcached-devel zlib-devel

/opt/plesk/php/7.0/bin/pecl install memcached

/opt/plesk/php/7.1/bin/pecl install memcached

/opt/plesk/php/7.2/bin/pecl install memcached

echo "extension=memcached.so" > /opt/plesk/php/7.0/etc/php.d/memcached.ini

echo "extension=memcached.so" > /opt/plesk/php/7.1/etc/php.d/memcached.ini

echo "extension=memcached.so" > /opt/plesk/php/7.2/etc/php.d/memcached.ini

plesk bin php_handler --reread

And then graceful restart LSWS and restart detached lsphp by killall lsphp or pkill lsphp.

PHP5.6

yum install -y make plesk-php56-devel gcc glibc-devel libmemcached-devel zlib-devel

/opt/plesk/php/5.6/bin/pecl install memcached-2.2.0

echo "extension=memcached.so" > /opt/plesk/php/5.6/etc/php.d/memcached.ini

plesk bin php_handler --reread

And then graceful restart LSWS.

For Native LSWS Environment

PHP memcached packages are pecl packages and named lsphpxx-pecl-memcached for CentOSs or lsphpxx-memcached for Debian and Ubuntu in LiteSpeed Repo.

For Centos:

yum install lsphp56-pecl-memcached lsphp70-pecl-memcached lsphp71-pecl-memcached lsphp72-pecl-memcached lsphp73-pecl-memcached lsphp74-pecl-memcached

For Debian and Ubuntu:

apt-get install lsphp70-memcached lsphp71-memcached lsphp72-memcached lsphp73-memcached lsphp74-memcached

And then graceful restart LSWS and restart detached lsphp by killall lsphp or pkill lsphp.

For cPanel:

Centos

PHP7.0/7.1/7.2

yum install -y libmemcached-devel

/opt/cpanel/ea-php70/root/usr/bin/pecl install memcached
/opt/cpanel/ea-php71/root/usr/bin/pecl install memcached
/opt/cpanel/ea-php72/root/usr/bin/pecl install memcached

echo "extension=memcached.so" > /opt/cpanel/ea-php70/root/etc/php.d/20-memcached.ini
echo "extension=memcached.so" > /opt/cpanel/ea-php71/root/etc/php.d/20-memcached.ini
echo "extension=memcached.so" > /opt/cpanel/ea-php72/root/etc/php.d/20-memcached.ini

And then graceful restart LSWS and restart detached lsphp by killall lsphp or pkill lsphp.

PHP5.6

yum install -y libmemcached-devel

/opt/cpanel/ea-php56/root/usr/bin/pecl install memcached-2.2.0

echo "extension=memcached.so" > /opt/cpanel/ea-php56/root/etc/php.d/20-memcached.ini

And then graceful restart LSWS and restart detached lsphp by killall lsphp or pkill lsphp.

Troubleshooting:

If installation returns error messages:

checking for libmemcached location... configure: error: memcached support requires libmemcached. Use --with-libmemcached-dir=<DIR> to specify the prefix where libmemcached headers and library are located
ERROR: `/root/tmp/pear/memcached/configure --with-php-config=/opt/cpanel/ea-php71/root/usr/bin/php-config --with-libmemcached-dir=no' failed

Please install libmemcached and the memcached extension by compiling from source code (replace php71 with your php version):

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 --prefix=/usr/local/libmemcached
# if above failed with error related to SASL , please run "yum install cyrus-sasl*" and run: (without #)
# ./configure --prefix=/usr/local/libmemcached  --enable-sasl
make
make install

wget http://pecl.php.net/get/memcached-3.0.4.tgz
tar zxvf memcached-3.0.4.tgz
cd memcached-3.0.4
/opt/cpanel/ea-php71/root/usr/bin/phpize
./configure --with-php-config=/opt/cpanel/ea-php71/root/usr/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --disable-memcached-sasl
# if above failed with error related to SASL , please run "yum install cyrus-sasl*" and run: (without #)
# ./configure --with-php-config=/opt/cpanel/ea-php71/root/usr/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --enable-memcached-sasl
make
make install
echo "memcached.so" > /opt/cpanel/ea-php71/root/etc/php.ini

And then graceful restart LSWS and restart detached lsphp by killall lsphp or pkill lsphp.

If you have further issues installing the extension on cPanel, please contact cPanel support.

CloudLinux

yum install ea-phpXX-php-memcached

Change XX to PHP version number , as php70, php71…etc

Direct Admin

PHP7.0/7.1/7.2

yum install -y libmemcached-devel

/usr/local/php70/bin/pecl install memcached
/usr/local/php71/bin/pecl install memcached
/usr/local/php72/bin/pecl install memcached

echo "extension=memcached.so" > /usr/local/php70/lib/php.conf.d/20-memcached.ini
echo "extension=memcached.so" > /usr/local/php71/lib/php.conf.d/20-memcached.ini
echo "extension=memcached.so" > /usr/local/php72/lib/php.conf.d/20-memcached.ini

And then graceful restart LSWS and restart detached lsphp by killall lsphp or pkill lsphp.

PHP5.6

yum install -y libmemcached-devel

/usr/local/php70/bin/pecl install memcached-2.2.0

echo "extension=memcached.so" > /usr/local/php56/lib/php.conf.d/20-memcached.ini

And then graceful restart LSWS and restart detached lsphp by killall lsphp or pkill lsphp.

Verify PHP memcached extension

Create a php file in vhost directory, and access it.

<?php

phpinfo();

?>

Memcached should be shown:

Понравилась статья? Поделить с друзьями:
  • Configure error lzo enabled but missing openvpn
  • Configure error libxml2 library not found zabbix
  • Connection refused код ошибки
  • Connection refused socket error 10061 connection refused socket error 10061
  • Connection refused no further information minecraft как исправить