• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

[solved] Add memcached to fcgi PHP

Elompenta

Regular Pleskian
I tried to add memcached to my - from plesk additional delivered - PHP Version 5.5 fcgi with the following notice from knowledgebase

http://kb.odin.com/de/125146

If i install all packages and install the Extension via pecl the followin error ecours:
Code:
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: `/tmp/memcached/configure --with-libmemcached-dir=no' failed

Any ideas how i can fix this issue and install memcached to my fcgi?
Here my full Output

Code:
root@server:# /opt/plesk/php/5.5/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
WARNING: php_bin /opt/plesk/php/5.5/bin/php appears to have a suffix /5.5/bin/php, but config variable php_suffix does not match
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-build-rootfWSmk3/memcached-2.2.0
running: /tmp/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... /opt/plesk/php/5.5
checking for PHP includes... -I/opt/plesk/php/5.5/include/php -I/opt/plesk/php/5.5/include/php/main -I/opt/plesk/php/5.5/include/php/TSRM -I/opt/plesk/php/5.5/include/php/Zend -I/opt/plesk/php/5.5/include/php/ext -I/opt/plesk/php/5.5/include/php/ext/date/lib
checking for PHP extension directory... /opt/plesk/php/5.5/lib/php/modules
checking for PHP installed headers prefix... /opt/plesk/php/5.5/include/php
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... /opt/plesk/php/5.5/include/php
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 with --disable-memcached-sasl to disable this check
ERROR: `/tmp/memcached/configure --with-libmemcached-dir=no' failed
root@server:/opt/plesk/php/5.5/bin#
root@server:/opt/plesk/php/5.5/bin#
root@server:/opt/plesk/php/5.5/bin#
 
Last edited:
Try to do following:

# yum install cyrus-sasl-devel

and then run

# /opt/plesk/php/5.5/bin/pecl install memcached
 
Sorry i missed this information - it was a Debian machine
the packet "cyrus-sasl-devel" does not exist in Debian

if i search i found the following:

cyrus-sasl2-dbg - Cyrus SASL - debugging symbols
cyrus-sasl2-doc - Cyrus SASL - documentation
cyrus-sasl2-heimdal-dbg - Cyrus SASL - debugging symbols for Heimdal modules
cyrus-sasl2-mit-dbg - Cyrus SASL - debugging symbols for MIT modules
libsasl2-2 - Cyrus SASL - authentication abstraction library
libsasl2-dev - Cyrus SASL - development files for authentication abstraction library
libsasl2-modules - Cyrus SASL - pluggable authentication modules
libsasl2-modules-gssapi-heimdal - Pluggable Authentication Modules for SASL (GSSAPI)
libsasl2-modules-gssapi-mit - Cyrus SASL - pluggable authentication modules (GSSAPI)
libsasl2-modules-ldap - Cyrus SASL - pluggable authentication modules (LDAP)
libsasl2-modules-otp - Cyrus SASL - pluggable authentication modules (OTP)
libsasl2-modules-sql - Cyrus SASL - pluggable authentication modules (SQL)
 
@Elompenta

Ehm, first you stated

PHP Version 5.4 fcgi

and then you stated

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

and I am just wondering whether you are using the wrong directory or the wrong php version.

Anyway, if you follow the procedures I have written in this DevBlog article you would be creating the memcached (pecl) extension properly.

If I am not mistaken, you can easily add the extension to PHP 5.4 by running the command: echo “extension=memcached.so” > /opt/plesk/php/5.4/etc/php.d/memcached.ini

Afterwards, do an Apache restart (for the sake of convenience).

And then you should be able to go to the PHP settings in your Plesk Panel and enable the memcache module by checking the appropriate checkbox.

Note that you should verify whether the memcache module works properly, all the above has not been tested by me (but it should work like a charm).

Regards.....
 
@trialotto
thanks for your information! - it was a typo in my first post. I've correct them
The correct Version is PHP 5.5

I have already found your articel - but it doesnt works on Debian. Some packets called unter a other name i think

Code:
root@venus:~# apt-get install make plesk-php55-devel gcc glibc-devel libmemcached-devel zlib-devel
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package plesk-php55-devel
E: Unable to locate package glibc-devel
E: Unable to locate package libmemcached-devel
E: Unable to locate package zlib-devel

I think i have installed all needed Debian packages, but i recieve all the time the following sasls error

Code:
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: `/tmp/memcached/configure --with-libmemcached-dir=no' failed

sasl is installed and work - any idea how i can fix this this error in memcached installation?

thanks for your help!
 
@Elompenta

Really, do NOT run a command like your apt-get command: that will NEVER work.

Follow the exact steps from the DevBlog article, in the directories described in that article and run the echo command:

a) echo “extension=memcached.so” > /opt/plesk/php/5.5/etc/php.d/memcached.ini

OR (if the above does not work)

b) echo “extension=<path to library>/memcached.so” > /opt/plesk/php/5.5/etc/php.d/memcached.ini

with <path to library> set to the location of the memcached.so file (note that it is safer to use option b from the start).

Furthermore, note that you have to be AWARE of the facts that

- you have a major issue with your repositories: run apt-get update before you start doing anything
- it is best to uninstall all packages from the previous attempts: otherwise, the old packages can cause problems

In essence, the memcached installation process also works on Debian, but your issues with repositories and old (probably broken) packages do cause problems.

Regards...
 
mmhh i dont understand your solution.. :(

I've found an existing memcached.so on the disk

Code:
root@venus:~# updatedb
root@venus:~# locate memcached.so
/usr/lib/php5/20100525/memcached.so
/usr/lib/x86_64-linux-gnu/libmemcached.so
/usr/lib/x86_64-linux-gnu/libmemcached.so.10
/usr/lib/x86_64-linux-gnu/libmemcached.so.10.0.0

If i create the additional ini file with the following command
Code:
root@venus:~# echo "extension=/usr/lib/php5/20100525/memcached.so" > /opt/plesk/php/5.5/etc/php.d/memcached.ini
root@venus:~# plesk bin php_handler --reread
The information about PHP handlers was successfully updated.
root@venus:~# /etc/init.d/apache2 restart
[ ok ] Restarting web server: apache2 ... waiting .

I will find the error on apache error log

Code:
PHP Warning:  PHP Startup: memcached: Unable to initialize module
Module compiled with module API=20100525
PHP  compiled with module API=20121212
These options need to match
 in Unknown on line 0


Vendor PHP Version is PHP 5.4, so i think i need to install PHP 5.5 compatibel Version via $ pecl install or not?

Code:
root@venus:~# php -v
PHP 5.4.45-0+deb7u2 (cli) (built: Oct 17 2015 08:26:31)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
  with the ionCube PHP Loader v4.6.0, Copyright (c) 2002-2014, by ionCube Ltd.
 
@trialotto
Do you have any idea to get the extension working?

I have no solution at this moment.
I will open a Plesk Ticket by Support Team - hope they are able to help

thanks
 
If i build the extension via pecl with the statement "--disable-memcached-sasl" building works fine

Code:
Build process completed successfully
Installing '/usr/lib/php5/20100525/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

If i now add the following php.ini
Code:
echo "extension=/usr/lib/php5/20100525/memcached.so" > /opt/plesk/php/5.5/etc/php.d/memcached.ini
plesk bin php_handler --reread
/etc/init.d/apache2 restart

i get the following error in the apache error log

Code:
PHP Warning:  PHP Startup: memcached: Unable to initialize module
Module compiled with module API=20100525
PHP  compiled with module API=20121212
These options need to match
 in Unknown on line 0

any ideas?
I hope forum or support can help in this issue

thanks so much
 
@Elompenta,

The module is attached, note that the modules has not been tested thoroughly: play with it and let me know.

Regards....
 

Attachments

  • memcached-5-5-31.zip
    125.1 KB · Views: 3
@trialotto
You are a very great guy! thanks so much

Just for Info - The Support Case
-------

Hello,

I was able to build memcached module for php5.6.
Here's how this was achieved:

1. First and foremost, please retrieve new lists of packages



# apt-get update
2. # apt-cache search plesk-php | grep dev



>>plesk-php55-snmp - A module for PHP applications that query SNMP-managed devices
>>plesk-php55-dev - Files needed for building PHP extensions
>>plesk-php56-snmp - A module for PHP applications that query SNMP-managed devices
>>plesk-php56-dev - Files needed for building PHP extensions
3. # apt-get install build-essential

4. # apt-get install make plesk-php55-dev gcc libc-dev libmemcached-dev zlib1g-dev pkg-config

pkg-config distribution is not mentioned in the guide(considering a RH-based system is used as an example there) but is essential to build the module.

5. Then, when you run:



# /opt/plesk/php/5.6/bin/pecl install memcached
when prompted for the libmemcached directory type "no --disable-memcached-sasl":



>> libmemcached directory [no] : no --disable-memcached-sasl
This is important. Otherwise the following will be thrown:



>>configure: error: no, libmemcached sasl support is not enabled. Run configure with --disable-memcached-sasl to disable this check
>>ERROR: `/tmp/memcached/configure --with-libmemcached-dir=no' failed
6. register the handler with Plesk:



# echo "extension=memcached.so" > /opt/plesk/php/5.6/etc/php.d/memcached.ini
# plesk bin php_handler --reread
7. Now you can go to Tools & Settings > PHP Settings > *any PHP 5.6 handler* and confirm that the memcached module is enabled for a particular handler

==========================================

As for php5.5, I couldn't install plesk-php55-dev because of unmet dependencies:



>>The following packages have unmet dependencies:
>>plesk-php55-dev : Depends: plesk-php55 (= 5.5.30-debian7.0.15102116) but 5.5.31-debian7.0.16011212 is to be installed
>>E: Unable to correct problems, you have held broken packages.
My guess - it has something to do with Plesk repository issues.
I have already requested assistance from our developers to sort this issue out. We will get back to you on Tue, Feb 2 regarding this matter.

So, for now you can build memcached module for php5.6 as a workaround of a kind.
 
@Elompenta,

That is not surprising, given that the PHP stack (currently installed with Plesk) does contain some items that are not fully compatible with PHP version 5.5.

However, a work-around should can be easily found, by simpy creating a "clean" PHP environment, just as I did, when compiling the memcached modules.

As a separate (i.e. completely independent of the above) remark: be aware that memcached is

- a little bit limited (in many dimensions, as opposed to Redis, (and)
- more difficult to work with, as opposed to Redis (certainly when using the Redis module based upon phpredis), (and)
- associated with a memcached module, that can be buggy (due to the fact that the source code of that modules is not that good, when compared to code for the Redis module)

and even though all is "relative", I would strongly advice to use the Redis Cache approach, in stead of memcached.

Naturally, Redis can also be used with PHP 5.5.

Regards.....
 
@trialotto

Plesk Support has find and fixed this issue:

--
We have fixed the issue with plesk-php55-dev packet.
There was a redirection problem with our repository http://autoinstall.plesk.com/

Now you can follow the same procedure for php 5.5
Let me know in case you have any other questions.
--
 
@Elompenta,

Then I suggest you compile the module via "pecl install", since that is the less error-prone method.

Note that, if you run the "pecl install" command from both the ../php/5.5/bin and ../php/5.6/bin paths, you still have to verify that the appropriate modules are compiled an installed.

Regards....
 
Back
Top