• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved How to get memcached working

neo2012

Basic Pleskian
Hello I have an Ubuntu 14.04.3 LTS‬ Server with Plesk 12.5.30 Update #19.
I installed php 5.6.17 and activated it for one website (domain) with FPM-with Apache. But the webite throws the error that no Memcached Class can be loaded. With the PHP 5.5.9 by OS Vendor it works. Like in the threat (http://talk.plesk.com/threads/please-share-your-opinion-about-odin-php-packages.335242/) where trialotto wrote: "The php memcached module is already included in the php 5.6.12 version in Plesk 12.5.30, so compiling it (with PECL) is not required: just activate or deactivate via the Contol Panel.
" should it work without installing it with pecl. But because its not php 5.6.12 I tried to install it.
Command: "root@server:/opt/plesk/php/5.6/bin# pecl install memcached"
Result:
downloading memcached-2.2.0.tgz ...
Starting to download memcached-2.2.0.tgz (70,449 bytes)
.................done: 70,449 bytes
15 source files, building
running: phpize
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
libmemcached directory [no] :

building in /tmp/pear/temp/pear-build-roottN1rlM/memcached-2.2.0
running: /tmp/pear/temp/memcached/configure --with-libmemcached-dir=no
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr
/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/inclu
de/php5/ext/date/lib
checking for PHP extension directory... /usr/lib/php5/20121212
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.5 (ok)
checking for gawk... gawk
checking whether to enable memcached support... yes, shared
checking for libmemcached... yes, shared
checking whether to enable memcached session handler support... yes
checking whether to enable memcached igbinary serializer support... no
checking whether to enable memcached json serializer support... no
checking whether to enable memcached msgpack serializer support... no
checking whether to enable memcached sasl support... yes
checking whether to enable memcached protocol support... no
checking for ZLIB... yes, shared
checking for pkg-config... /usr/bin/pkg-config
checking for zlib location... /usr
checking for session includes... /usr/include/php5
checking for memcached session support... enabled
checking for memcached igbinary support... disabled
checking for memcached msgpack support... disabled
checking for libmemcached location... found version 1.0.8, under /usr
checking whether to enable sasl support... yes
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking sasl/sasl.h usability... yes
checking sasl/sasl.h presence... yes
checking for sasl/sasl.h... yes
checking whether libmemcached supports sasl... no
configure: error: no, libmemcached sasl support is not enabled. Run configure wi
th --disable-memcached-sasl to disable this check
ERROR: `/tmp/pear/temp/memcached/configure --with-libmemcached-dir=no' failed
root@server:/opt/plesk/php/5.6/bin# echo "extension=memcached.so" > /opt/plesk/p
hp/5.6/etc/php.d/memcached.ini
root@server:/opt/plesk/php/5.6/bin# php -i | grep "memcached support"
memcached support => enabled

The memcashed support is possibly only shown for the other domain which uses still php 5.5.9 where memcashed works. In the phpinfo() for the domain with php 5.6.17 memcached is not activated because of the config error.

So site is still not working.
Thanks for help!
 
Last edited:
@neo2012

You are not the first one with this problem, have a look at my suggestions in http://talk.plesk.com/threads/add-memcached-to-fcgi-php.336629/#post-794911

Moreover, using memcache is somewhat strange, given the obvious limitations of memcache (daemon) server, certainly when compared to the more flexible Redis server.

I have compiled a Redis module and added some rough guidelines to install it: have a look at http://talk.plesk.com/threads/redis-module-for-php-7-0-1-and-7-0-2.336648/

Hope the above helps!

Regards...

PS If you want me to have a thorough look into the memcached issue, just start a conversation and allow me some time to compile and test a memcached module.
 
Thanks for your help. I tried it:
Code:
root@server:/opt/plesk/php/5.6/bin# apt-get install make plesk-php56-dev gcc gli
bc-dev libmemcached-dev zlib-dev
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
E: Paket glibc-dev kann nicht gefunden werden.
E: Paket zlib-dev kann nicht gefunden werden.
So what are the correct package names for "glibc-devel" and "zlib-devel" like in threat: https://devblog.plesk.com/2015/08/adding-custom-php-modules-in-plesk/

Then:
Code:
root@server:/opt/plesk/php/5.6/bin# pecl install memcached
downloading memcached-2.2.0.tgz ...
Starting to download memcached-2.2.0.tgz (70,449 bytes)
.................done: 70,449 bytes
15 source files, building
running: phpize
Configuring for:
PHP Api Version:  20121113
Zend Module Api No:  20121212
Zend Extension Api No:  220121212
libmemcached directory [no] :
building in /tmp/pear/temp/pear-build-rootwFiOBN/memcached-2.2.0
running: /tmp/pear/temp/memcached/configure --with-libmemcached-dir=no
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr
/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/inclu
de/php5/ext/date/lib
checking for PHP extension directory... /usr/lib/php5/20121212
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.5 (ok)
checking for gawk... gawk
checking whether to enable memcached support... yes, shared
checking for libmemcached... yes, shared
checking whether to enable memcached session handler support... yes
checking whether to enable memcached igbinary serializer support... no
checking whether to enable memcached json serializer support... no
checking whether to enable memcached msgpack serializer support... no
checking whether to enable memcached sasl support... yes
checking whether to enable memcached protocol support... no
checking for ZLIB... yes, shared
checking for pkg-config... /usr/bin/pkg-config
checking for zlib location... /usr
checking for session includes... /usr/include/php5
checking for memcached session support... enabled
checking for memcached igbinary support... disabled
checking for memcached msgpack support... disabled
checking for libmemcached location... found version 1.0.8, under /usr
checking whether to enable sasl support... yes
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking sasl/sasl.h usability... yes
checking sasl/sasl.h presence... yes
checking for sasl/sasl.h... yes
checking whether libmemcached supports sasl... no
configure: error: no, libmemcached sasl support is not enabled. Run configure wi
th --disable-memcached-sasl to disable this check
ERROR: `/tmp/pear/temp/memcached/configure --with-libmemcached-dir=no' failed
So I tried to search for cyrus-sasl-devel because install what IgorG wrote in http://talk.plesk.com/threads/add-memcached-to-fcgi-php.336629/#post-794911 didn't work with apt-get
Code:
root@server:/opt/plesk/php/5.6/bin# apt-cache search cyrus-sasl
cyrus-sasl2-dbg - Cyrus SASL - Fehlerdiagnosesymbole
cyrus-sasl2-doc - Cyrus SASL - Dokumentation
cyrus-sasl2-heimdal-dbg - Cyrus SASL - Fehlerdiagnosesymbole für Heimdal-Module
cyrus-sasl2-mit-dbg - Cyrus SASL - Fehlerdiagnosesymbole für MIT-Module
libauthen-sasl-perl - Authen::SASL - Gerüst für SASL-Authentifizierung
libsasl2-modules - Cyrus SASL - »steckbare« Authentifizierungs-Module
libsasl2-modules-db - Cyrus SASL - pluggable authentication modules (DB)
libsasl2-modules-gssapi-heimdal - Pluggable Authentication Modules for SASL (GSS
API)
libsasl2-modules-gssapi-mit - Cyrus SASL - pluggable authentication modules (GSS
API)
libsasl2-modules-sql - Cyrus SASL - pluggable authentication modules (SQL)
sasl2-bin - Cyrus SASL - administration programs for SASL users database
libsasl2-modules-ldap - Cyrus SASL - Pluggable Authentication Modules (LDAP)
libsasl2-modules-otp - Cyrus SASL - pluggable authentication modules (OTP)
libqca2-plugin-cyrus-sasl - QCA Cyrus SASL plugin for libqca2
I don't know if here is the right package?
 
Now I tried to install without sasl (I think/hope I won't really need it):
Code:
root@server:/opt/plesk/php/5.6/bin# pecl install memcached
downloading memcached-2.2.0.tgz ...
Starting to download memcached-2.2.0.tgz (70,449 bytes)
.................done: 70,449 bytes
15 source files, building
running: phpize
Configuring for:
PHP Api Version:  20121113
Zend Module Api No:  20121212
Zend Extension Api No:  220121212
libmemcached directory [no] : no --disable-memcached-sasl
building in /tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0
running: /tmp/pear/temp/memcached/configure --with-libmemcached-dir=no --disable
-memcached-sasl
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr
/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/inclu
de/php5/ext/date/lib
checking for PHP extension directory... /usr/lib/php5/20121212
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.5 (ok)
checking for gawk... gawk
checking whether to enable memcached support... yes, shared
checking for libmemcached... yes, shared
checking whether to enable memcached session handler support... yes
checking whether to enable memcached igbinary serializer support... no
checking whether to enable memcached json serializer support... no
checking whether to enable memcached msgpack serializer support... no
checking whether to enable memcached sasl support... no
checking whether to enable memcached protocol support... no
checking for ZLIB... yes, shared
checking for pkg-config... /usr/bin/pkg-config
checking for zlib location... /usr
checking for session includes... /usr/include/php5
checking for memcached session support... enabled
checking for memcached igbinary support... disabled
checking for memcached msgpack support... disabled
checking for libmemcached location... found version 1.0.8, under /usr
checking whether to enable sasl support... no
checking for memcached protocol support... disabled
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-li
nux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format.
.. func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libra
ries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
running: make
[...]
Rest in next Reply
 
Code:
[...]
/bin/bash /tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/libtool --mode=co
mpile cc -I/usr/include/php5  -I. -I/tmp/pear/temp/memcached -DPHP_ATOM_INC -I
/tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/include -I/tmp/pear/temp/pe
ar-build-root0WgF56/memcached-2.2.0/main -I/tmp/pear/temp/memcached -I/usr/inclu
de/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Ze
nd -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib  -DHAVE_CONFIG_H  -g
 -O2  -c /tmp/pear/temp/memcached/php_memcached.c -o php_memcached.lo
libtool: compile:  cc -I/usr/include/php5 -I. -I/tmp/pear/temp/memcached -DPHP_A
TOM_INC -I/tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/include -I/tmp/pe
ar/temp/pear-build-root0WgF56/memcached-2.2.0/main -I/tmp/pear/temp/memcached -I
/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/inclu
de/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -DHAVE_CON
FIG_H -g -O2 -c /tmp/pear/temp/memcached/php_memcached.c  -fPIC -DPIC -o .libs/p
hp_memcached.o
/tmp/pear/temp/memcached/php_memcached.c: In function 'zim_Memcached_fetch':
/tmp/pear/temp/memcached/php_memcached.c:1067:2: warning: passing argument 4 of
'add_assoc_stringl_ex' discards 'const' qualifier from pointer target type [enab
led by default]
  add_assoc_stringl_ex(return_value, ZEND_STRS("key"), res_key, res_key_len, 1);
  ^
In file included from /usr/include/php5/main/php.h:39:0,
  from /tmp/pear/temp/memcached/php_memcached.h:22,
  from /tmp/pear/temp/memcached/php_memcached.c:25:
/usr/include/php5/Zend/zend_API.h:382:14: note: expected 'char *' but argument i
s of type 'const char *'
 ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, cha
r *str, uint length, int duplicate);
  ^
/tmp/pear/temp/memcached/php_memcached.c: In function 'zim_Memcached_fetchAll':
/tmp/pear/temp/memcached/php_memcached.c:1126:3: warning: passing argument 4 of
'add_assoc_stringl_ex' discards 'const' qualifier from pointer target type [enab
led by default]
  add_assoc_stringl_ex(entry, ZEND_STRS("key"), res_key, res_key_len, 1);
  ^
In file included from /usr/include/php5/main/php.h:39:0,
  from /tmp/pear/temp/memcached/php_memcached.h:22,
  from /tmp/pear/temp/memcached/php_memcached.c:25:
/usr/include/php5/Zend/zend_API.h:382:14: note: expected 'char *' but argument i
s of type 'const char *'
 ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, cha
r *str, uint length, int duplicate);
  ^
/tmp/pear/temp/memcached/php_memcached.c: In function 'php_memc_do_result_callba
ck':
/tmp/pear/temp/memcached/php_memcached.c:3675:2: warning: passing argument 4 of
'add_assoc_stringl_ex' discards 'const' qualifier from pointer target type [enab
led by default]
  add_assoc_stringl_ex(z_result, ZEND_STRS("key"), res_key, res_key_len, 1);
  ^
In file included from /usr/include/php5/main/php.h:39:0,
  from /tmp/pear/temp/memcached/php_memcached.h:22,
  from /tmp/pear/temp/memcached/php_memcached.c:25:
/usr/include/php5/Zend/zend_API.h:382:14: note: expected 'char *' but argument i
s of type 'const char *'
 ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, cha
r *str, uint length, int duplicate);
  ^
/bin/bash /tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/libtool --mode=co
mpile cc -I/usr/include/php5  -I. -I/tmp/pear/temp/memcached -DPHP_ATOM_INC -I
/tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/include -I/tmp/pear/temp/pe
ar-build-root0WgF56/memcached-2.2.0/main -I/tmp/pear/temp/memcached -I/usr/inclu
de/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Ze
nd -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib  -DHAVE_CONFIG_H  -g
 -O2  -c /tmp/pear/temp/memcached/php_libmemcached_compat.c -o php_libmemcached
_compat.lo
libtool: compile:  cc -I/usr/include/php5 -I. -I/tmp/pear/temp/memcached -DPHP_A
TOM_INC -I/tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/include -I/tmp/pe
ar/temp/pear-build-root0WgF56/memcached-2.2.0/main -I/tmp/pear/temp/memcached -I
/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/inclu
de/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -DHAVE_CON
FIG_H -g -O2 -c /tmp/pear/temp/memcached/php_libmemcached_compat.c  -fPIC -DPIC
-o .libs/php_libmemcached_compat.o
/bin/bash /tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/libtool --mode=co
mpile cc -I/usr/include/php5  -I. -I/tmp/pear/temp/memcached -DPHP_ATOM_INC -I
/tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/include -I/tmp/pear/temp/pe
ar-build-root0WgF56/memcached-2.2.0/main -I/tmp/pear/temp/memcached -I/usr/inclu
de/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Ze
nd -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib  -DHAVE_CONFIG_H  -g
 -O2  -c /tmp/pear/temp/memcached/fastlz/fastlz.c -o fastlz/fastlz.lo
libtool: compile:  cc -I/usr/include/php5 -I. -I/tmp/pear/temp/memcached -DPHP_A
TOM_INC -I/tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/include -I/tmp/pe
ar/temp/pear-build-root0WgF56/memcached-2.2.0/main -I/tmp/pear/temp/memcached -I
/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/inclu
de/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -DHAVE_CON
FIG_H -g -O2 -c /tmp/pear/temp/memcached/fastlz/fastlz.c  -fPIC -DPIC -o fastlz/
.libs/fastlz.o
[...]
 
Code:
/bin/bash /tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/libtool --mode=co
mpile cc -I/usr/include/php5  -I. -I/tmp/pear/temp/memcached -DPHP_ATOM_INC -I
/tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/include -I/tmp/pear/temp/pe
ar-build-root0WgF56/memcached-2.2.0/main -I/tmp/pear/temp/memcached -I/usr/inclu
de/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Ze
nd -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib  -DHAVE_CONFIG_H  -g
 -O2  -c /tmp/pear/temp/memcached/g_fmt.c -o g_fmt.lo
libtool: compile:  cc -I/usr/include/php5 -I. -I/tmp/pear/temp/memcached -DPHP_A
TOM_INC -I/tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/include -I/tmp/pe
ar/temp/pear-build-root0WgF56/memcached-2.2.0/main -I/tmp/pear/temp/memcached -I
/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/inclu
de/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -DHAVE_CON
FIG_H -g -O2 -c /tmp/pear/temp/memcached/g_fmt.c  -fPIC -DPIC -o .libs/g_fmt.o
/bin/bash /tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/libtool --mode=co
mpile cc -I/usr/include/php5  -I. -I/tmp/pear/temp/memcached -DPHP_ATOM_INC -I
/tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/include -I/tmp/pear/temp/pe
ar-build-root0WgF56/memcached-2.2.0/main -I/tmp/pear/temp/memcached -I/usr/inclu
de/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Ze
nd -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib  -DHAVE_CONFIG_H  -g
 -O2  -c /tmp/pear/temp/memcached/php_memcached_session.c -o php_memcached_sess
ion.lo
libtool: compile:  cc -I/usr/include/php5 -I. -I/tmp/pear/temp/memcached -DPHP_A
TOM_INC -I/tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/include -I/tmp/pe
ar/temp/pear-build-root0WgF56/memcached-2.2.0/main -I/tmp/pear/temp/memcached -I
/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/inclu
de/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -DHAVE_CON
FIG_H -g -O2 -c /tmp/pear/temp/memcached/php_memcached_session.c  -fPIC -DPIC -o
 .libs/php_memcached_session.o
/bin/bash /tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/libtool --mode=li
nk cc -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/incl
ude -I/tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/main -I/tmp/pear/temp
/memcached -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM
 -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/l
ib  -DHAVE_CONFIG_H  -g -O2  -o memcached.la -export-dynamic -avoid-version -pr
efer-pic -module -rpath /tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/mod
ules  php_memcached.lo php_libmemcached_compat.lo fastlz/fastlz.lo g_fmt.lo php_
memcached_session.lo -lz -lmemcached -lmemcachedutil
libtool: link: cc -shared  -fPIC -DPIC  .libs/php_memcached.o .libs/php_libmemca
ched_compat.o fastlz/.libs/fastlz.o .libs/g_fmt.o .libs/php_memcached_session.o
  -lz -lmemcached -lmemcachedutil  -O2  -Wl,-soname -Wl,memcached.so -o .libs/m
emcached.so
libtool: link: ( cd ".libs" && rm -f "memcached.la" && ln -s "../memcached.la" "
memcached.la" )
/bin/bash /tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/libtool --mode=in
stall cp ./memcached.la /tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/mod
ules
libtool: install: cp ./.libs/memcached.so /tmp/pear/temp/pear-build-root0WgF56/m
emcached-2.2.0/modules/memcached.so
libtool: install: cp ./.libs/memcached.lai /tmp/pear/temp/pear-build-root0WgF56/
memcached-2.2.0/modules/memcached.la
libtool: finish: PATH="/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bi
n:/sbin:/bin:/usr/games:/usr/local/games:/sbin" ldconfig -n /tmp/pear/temp/pear-
build-root0WgF56/memcached-2.2.0/modules
----------------------------------------------------------------------
Libraries have been installed in:
  /tmp/pear/temp/pear-build-root0WgF56/memcached-2.2.0/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
  - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
  during execution
  - add LIBDIR to the `LD_RUN_PATH' environment variable
  during linking
  - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
  - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

running: make INSTALL_ROOT="/tmp/pear/temp/pear-build-root0WgF56/install-memcach
ed-2.2.0" install
Installing shared extensions:  /tmp/pear/temp/pear-build-root0WgF56/install-m
emcached-2.2.0/usr/lib/php5/20121212/
running: find "/tmp/pear/temp/pear-build-root0WgF56/install-memcached-2.2.0" | x
args ls -dils
1049772  4 drwxr-xr-x 3 root root  4096 Jan 24 12:36 /tmp/pear/temp/pear-build
-root0WgF56/install-memcached-2.2.0
1049804  4 drwxr-xr-x 3 root root  4096 Jan 24 12:36 /tmp/pear/temp/pear-build
-root0WgF56/install-memcached-2.2.0/usr
1049805  4 drwxr-xr-x 3 root root  4096 Jan 24 12:36 /tmp/pear/temp/pear-build
-root0WgF56/install-memcached-2.2.0/usr/lib
1049806  4 drwxr-xr-x 3 root root  4096 Jan 24 12:36 /tmp/pear/temp/pear-build
-root0WgF56/install-memcached-2.2.0/usr/lib/php5
1049807  4 drwxr-xr-x 2 root root  4096 Jan 24 12:36 /tmp/pear/temp/pear-build
-root0WgF56/install-memcached-2.2.0/usr/lib/php5/20121212
1049803 376 -rwxr-xr-x 1 root root 382446 Jan 24 12:36 /tmp/pear/temp/pear-build
-root0WgF56/install-memcached-2.2.0/usr/lib/php5/20121212/memcached.so

Build process completed successfully
Installing '/usr/lib/php5/20121212/memcached.so'
install ok: channel://pecl.php.net/memcached-2.2.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=memcached.so" to php.ini
And
Code:
root@server:/opt/plesk/php/5.6/bin# echo "extension=memcached.so" > /opt/plesk/p
hp/5.6/etc/php.d/memcached.ini
root@server:/opt/plesk/php/5.6/bin# /etc/init.d/apache2 restart
 * Restarting web server apache2  [ OK ]
root@server:/opt/plesk/php/5.6/bin# plesk bin php_handler --reread
The information about PHP handlers was successfully updated.
But in Tools & Settings > PHP Settings > PHP 5.6.17-FPM handler
I just can't find memcached (see: http://l51i.imgup.net/plesk_php8dd5.png -->Image was in preview not working so Url only)

And now?
 
OK, I just changed the path to the memcached.so and now it's working!
Code:
root@server:/opt/plesk/php/5.6/bin# echo "extension=/usr/lib/php5/20121212/memca
ched.so" > /opt/plesk/php/5.6/etc/php.d/memcached.ini
root@server:/opt/plesk/php/5.6/bin# /etc/init.d/apache2 restart
 * Restarting web server apache2  [ OK ]
root@server:/opt/plesk/php/5.6/bin# plesk bin php_handler --reread
The information about PHP handlers was successfully updated.
 
@neo2012,

Glad to see that it is working, it is not rocket science to create and enable the memcached module.

However, note that there is one peculiar thing about your setup: the library should normally not reside in a /usr/lib directory.

This probably has something to do with the hosting provider and/or your personal settings: it is all about this

Zend Module Api No: 20121212
Zend Extension Api No: 220121212

For the proper functioning of the memcached module, the above can become an issue, but for the time being you should be safe.

I would strongly advice to check regularly that your memcached module is working as it should be.

Regards....
 
Hello trialotto. Yes it's not rocket sience, but if you are newby in case of server administration, then sometimes it seems like rocket science. ;)

EDIT: My fault! I had still the OS version php 5.5.9 saved for the site, so it was working. I just checked it again and set the target php version to 5.6.17 and it does NOT work! Even if it shows that memcached is enabled in the plesk admin panel. Fu... It's not activated in phpinfo()

So you are right trialotto. And I don't know what to do to get it working (or I have to try redis...)
Why should the library not reside in a /usr/lib directory?
How can this be changed? What could I do now to get this working?
 
Last edited:
@neo2012

Let´s start with this question
Why should the library not reside in a /usr/lib directory?

Well, it is not a problem, the directory can be any place, but it is quite uncommon to have the compiled module in a /usr/lib directory.

In essence, this directory is configured at build time, indicating that you either have a wrong memcached package (the module) or have some other compilation issue.

Now return to this statement

How can this be changed? I didn't define it, just let install ubuntu with plesk 12.0 and run the update to 12.5. Ok I did additionally install memcashed once a time, when I still had plesk 12.0. But I can't really remind, that I set this path.

and I can safely conclude that this does not surprise me, given the values for the Zend Module API and Zend Extension API.

In short, do a complete uninstall/removal of the packages you used, when installing the module in Plesk 12.0.x (and also remove all modules, for the sake of a clean start).

Note that it I strongly advice to uninstall all plesk-php56-dev (and associated) packages, run a "apt-get autoremove" and re-install the packages afterwards.

Then re-run the whole process on your new server, with emphasis on the following: if you encounter problems again, then not all packages were removed properly.

By the way, if I am not mistaken, when using the (fresh) plesk-php56-dev, "pecl install memcached" would be sufficient.

However, it can be the case that similar issues will re-occur, so keep me posted....

Regards
 
I hope I have deinstalled all now. But before trying again with memcached I would give redis a try. So installed php5.6.17 again with plesk installer and in php settings redis is activated and phpinfo() shows also that Redis Version 2.2.5 is enabled. I changed the caching handler of my laravel project to redis, but now I get "Connection refused [tcp://127.0.0.1:6379]". So did I miss something? Will I have to install a redis server also? Or why can't php connect to redis?
 
Ok the redis-server was not installed yet. Now it seems to be working with php 5.6.17. trialotto I will also try your explanation for php7 later. :) Do you have simple tips for configuring redis as caching server or is the default config ok?
 
@neo2012,

In response to

Ok the redis-server was not installed yet. Now it seems to be working with php 5.6.17. trialotto I will also try your explanation for php7 later. :) Do you have simple tips for configuring redis as caching server or is the default config ok?

I have to admit that I am still testing a proper configuration, suitable for Plesk instances and a non-clustered Redis server.

Nevertheless, the normal (i.e. default) configuration of Redis should work fine, the only thing that you have to watch out for is the "max memory setting".

Moreover, Redis (and it´s performance) is "dependent" on the method of loading/using key-value pairs in (for instance) php files and "dependent" on the application you are using Redis for (for example, a WordPress instance does require a different caching approach, in comparison to other applications).

In short, some general tips:

a) identify the application for which you intend to use Redis,
b) identify your caching desires and requirements,
c) create an appropriate design for the caching structure,
d) create an appropriate caching script,
e) do some elaborate testing, including stress testing,

and the above boils down to a template of tasks to be executed, when wanting to cache a specific site.

To illustrate, let´s apply the above "template" to a WordPress (henceforth: WP) site, that you want to cache.

First, we already know that we want to use Redis for WordPress caching and this has some consequences:

- some plugins should be considered obsolete, when caching with Redis: it is best to deactivate any WP caching plugin (or at least the caching parts), such as W3TC (page cache, etc.)
- we do not want to cache specific pages, such as pages that require a login by users and/or the administrators,
- we need to use a custom index.php file, containing all the caching calls (i.e. the Redis get/set calls),
- we have to be aware that WP can or will overwrite files, including the index.php file, at every update of WP core (and only if the core is updated),

and that is about it. The relevance of the above will become clear shortly.

Second, (on the one hand) our caching desires our defined by "do not cache users/administrators and cache everything else" and (on the other hand) our caching requirements are defined by our caching desires AND are confined by the fact that the index.php file can change when WP updates.

The before mentioned confinement implies that one additional requirement is present: it should be possible to update the (default) index.php file, without the necessity to recreate or re-instate the custom index.php file.

For that reason, one is required to have:

- an additional, custom index.php file, let´s call it index-redis.php, (and)
- some dynamic URL rewrite (i.e. index.php to index-redis.php), by preference the Nginx rewrite with the try_files directive

Note that the Nginx configuration would be very simple, but for the sake of convenience, I will leave this out.

Third, the appropriate design for the caching structure is defined by our caching desires and requirements and the fact that we have to use a dynamic URL rewrite.

Nevertheless, one can consider to add a clustered Redis Server, as opposed to a stand-alone Redis Server, but for a couple of WP instances, this is not worthwhile.

The above implies that you can use a stand-alone Redis Server for WP caching, on the same (local)host, using a local connection on port 6379 (non-standard ports are not required).

However, the problem with a Redis Server installation is that the (default) port 6379 is opened for all traffic AND that Redis Server can take a huge amount of connections per SECOND.

The above can imply that outside attacks can aim at the Redis Server and disable the whole system, including the WP site.

The best way to prevent such problems is to use the Plesk Firewall (or iptables, if you know what you are doing) and (only!) allow local connections to port 6379.

Fourth, create the index-redis.php file.

This can be quite challenging, so use a trial-and-error approach. Test every call of the get/set commands for the Redis Server and improve the index-redis file step by step.

Note: there are a lot of standard scripts, that can be found online. However, these scripts are often outdated. Use them for inspiration, do not copy or implement them!

Note: one does not have to programm "Redis classes", that has been compiled into the Redis module (at least, in the module I have made available on this forum).

Fifth and final, do some stress testing, for instance with the siege command. It can give you an indication on how well the Redis scripts and server perform under heavy loads.

Note: most Redis related problems under heavy loads can be adjusted or even resolved by increasing the max memory setting in the Redis configuration. Do not increase too much!

Note: do some testing with outside, direct calls to the Redis server, in order to test firewall settings. Can do no harm.


In summary, a lot of words, but the implementation of Redis is quite simple, as long as you have a proper "index-redis.php" file and taken into account some basic considerations.

The considerations are more or less given above and I certainly hope that the above explains or helps a little bit.

The proper index-redis.php file, well, I suppose that I can have a look at that, if somebody wants me to: just start a personal conversation!

Regards.....
 
Thank you for this answer! I use the laravel framework, that already has included caching methods (like memcached,redis,filesystem,mysql,apc...) for sessions and site cache. At this time I only use the caching for the sessions, because of the dayly changing result data the site cache is not really usefull - maybe I'm wrong? So redis is just used for user session values. Do you think it might be usefull to combine redis with igbinary for compressing the strings? If yes, is it easy to get this working? I don't have any knowledge about stress testing with the siege command...before I ask for help, I will search in google for it. But a tip about it would be nice! :)
 
@neo2012

It is not a good idea to use the laravel framework and the Redis module side-by-side, since that is a huge load of (essentially) similar and hence duplicate Redis classes.

Furthermore, "beautiful code" (i.e. laravel framework) comes at a price: a small performance penalty, lags in implementation of latest releases of included packages, duplicate code etc.

Personally, I am not sure about the added value of this particular framework and most adopters are sooner or later returning back to basics.

In addition, igbinary is also an "odd piece of development work": as an idea, it is a beauty, but it completely ignores the fact that serialization performance has to start with the object to be serialized (for instance, serialization of large objects, of which only a part will be used at one time, is "bad practice", it is better to split up the large object into multiple small objects).

Personally, I am pretty sure that igbinary helps for bad code, but then again, shouldn´t bad code be prevented?

Moreover, igbinary is not or should not be necessary for Redis Cache (not at all!), as opposed to Memcache(d) Cache (which latter cache has a relatively small limit on values).

Redis Cache can store up to 512Mb of (string) values and, in essence, one could or should never create code that reaches that limit.

In short, no, igbinary and Redis are not to be combined with each other, for many reasons.

Regards.....
 
Thanks for your advices! Of course you are right, that bad code should be prevented. But sometimes if it's a learning process, then you don't know it better or don't have the time to write better code or develop everthing self instead of using a framework.
 
@neo2012

You stated
But sometimes if it's a learning process
.

In essence, there is a relation between your statement and the usual principle of "bad questions result in bad answers".

A good learning process does not involve getting the right questions (in this case, the "answers" provided by the laravel framework), but it should involve getting the insight to ask the right questions (in this case: why and when should I use specific code or software packages, under what conditions and what are the dependencies?).

That is my humble opinion, just some food for thought.

Regards...
 
Hi.

I'm also using ubuntu 14.04 with plesk 12.5.30.

I've completed the process described here:

https://www.plesk.com/blog/adding-custom-php-modules-in-plesk/

adjusting the packages names to ubuntu.

It seems to be all good, has I've it available in phpinfo().

In my prestashop, when I select memcached he ask me to add a server, but with ps -aux, I don't see anything running related to memcached.

How do I make it run?

Runnign the folowing code that I've found in Magento forum doesn't work.

Code:
<?php
if (class_exists('Memcache')) {
   $meminstance = new Memcache();
} else {
   $meminstance = new Memcached();
}

$meminstance->addServer("<memcache host name or ip>", <memcache port>);

$result = $meminstance->get("test");

if ($result) {
   echo $result;
} else {
   echo "No matching key found.  Refresh the browser to add it!";
   $meminstance->set("test", "Successfully retrieved the data!") or die("Couldn't save anything to memcached...");
}
?>

opening the page related to this code for the first time states:

"No matching key found. Refresh the browser to add it!Couldn't save anything to memcached..."

The part "Couldn't save anything to memcached..." was not supposed to appear. This means it's not working.

Can someone help?
 
Back
Top