• 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 php7 and memcached - again

Franco

Regular Pleskian
Hello,
I have been struggling for a while to install memcache extenstion to php and I'd like some guidance, please. Memcached runs, but the extension on php 7 is uncomplete. For instance, I can't complete the installation as I get an error ("No valid packages found") when running the final step for /opt/plesk/php/7.0/bin/pecl install memcached (see https://devblog.plesk.com/2015/08/adding-custom-php-modules-in-plesk/). I do not seem to be the only one.

The apache error log shows a long stream of:

PHP Warning: PHP Startup: Unable to load dynamic library '/opt/plesk/php/7.0/lib64/php/modules/memcached.so' - /opt/plesk/php/7.0/lib64/php/modules/memcached.so: cannot open shared object file: No such file or directory in Unknown on line 0

I do not see the extension available on Plesk php settings either :(

Help, please.
 
You should see following error:

# /opt/plesk/php/7.0/bin/pecl install memcached
pecl/memcached requires PHP (version >= 5.2.0, version <= 6.0.0, excluded versions: 6.0.0), installed version is 7.0.4
No valid packages found
 
Do you mean memcached or memcache? Do you know the difference?
 
Well, I think I know that. There's a deamon and then libraries needed by php to interface with it.

The error you point at is due to a failed installation of the library, I guess, as described here: https://devblog.plesk.com/2015/08/adding-custom-php-modules-in-plesk/

My memcached deamon is running:

491 31366 0.0 0.0 331124 1076 ? Ssl 09:37 0:00 memcached -d -p 11211 -u memcached -m 64 -c 1024 -P /var/run/memcached/memcached.pid -l 127.0.0.1

Now what shall I do?
 
Well. Let me clarify a little bit.
Yes, you have started memcache daemon. You need to compile client php bindings for connection to this daemon.
Actually, memcached does not support PHP7 - https://pecl.php.net/package/memcached
But there are some solutions, for example - https://serversforhackers.com/video/installing-php-7-with-memcached
You can try to adapt it to your case, at least.
Something like:

# yum install make plesk-php70-devel gcc glibc-devel libmemcached-devel zlib-devel git
# git clone https://github.com/php-memcached-dev/php-memcached.git
# cd php-memcached/
# git checkout php7
# /opt/plesk/php/7.0/bin/phpize
# ./configure --disable-memcached-sasl --with-php-config=/opt/plesk/php/7.0/bin/php-config
# make && make install

And then as in the article on devblog.
You can try, at least, with my direction :)
 
Additionally for CentOS6, before steps above you need to update libmemcached to >1.0.x version with following steps:

# wget http://mirror.symnds.com/distributions/gf/el/6/plus/i386/libmemcached-1.0.16-2.gf.el6.i686.rpm
# wget http://mirror.symnds.com/distributions/gf/el/6/plus/i386/libmemcached-devel-1.0.16-2.gf.el6.i686.rpm
# wget http://mirror.symnds.com/distributions/gf/el/6/plus/i386/libmemcached-libs-1.0.16-2.gf.el6.i686.rpm

# yum install libmemcached-devel-1.0.16-2.gf.el6.i686.rpm libmemcached-1.0.16-2.gf.el6.i686.rpm libmemcached-libs-1.0.16-2.gf.el6.i686.rpm

After that all steps from posts above. After '# make && make install' run

# echo "extension=memcached.so" > /opt/plesk/php/7.0/etc/php.d/memcached.ini
# plesk bin php_handler --reread

That's all :)
 
Thanks, Igor, I really appreciate your help. However, I am getting this error on the yum install libmemcached....:
Loaded plugins: fastestmirror
Setting up Install Process
Examining libmemcached-devel-1.0.16-2.gf.el6.i686.rpm: libmemcached-devel-1.0.16-2.gf.el6.i686
libmemcached-devel-1.0.16-2.gf.el6.i686.rpm: does not update installed package.
Examining libmemcached-1.0.16-2.gf.el6.i686.rpm: libmemcached-1.0.16-2.gf.el6.i686
libmemcached-1.0.16-2.gf.el6.i686.rpm: does not update installed package.
Examining libmemcached-libs-1.0.16-2.gf.el6.i686.rpm: libmemcached-libs-1.0.16-2.gf.el6.i686
Marking libmemcached-libs-1.0.16-2.gf.el6.i686.rpm to be installed
Loading mirror speeds from cached hostfile
* atomic: mirror1.34sp.com
* epel: mirror0.babylon.network
http://autoinstall.plesk.com/PHP_7....85a0216149dfe2d026dd336bbd-primary.sqlite.bz2: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
Error: failure: repodata/a045b0ee079777c50097ac788e38f2e0380aa585a0216149dfe2d026dd336bbd-primary.sqlite.bz2 from plesk-php-7.0: [Errno 256] No more mirrors to try.
 
Do you really have CentOS6? Maybe it is related to enabled atomic and epel repositories...
 
Well, as after all that I could not run yum at all (as it happens we get php 7.0.4 and it was failing on the same error code) I run yum clean all and after that I could continue the installationn and follow all your instructions without a glitch, and finally I get my memcache extension installed!! And I see it in Plesk as well :)

Nice, thank you!
 
Well. Let me clarify a little bit.
Yes, you have started memcache daemon. You need to compile client php bindings for connection to this daemon.
Actually, memcached does not support PHP7 - https://pecl.php.net/package/memcached
But there are some solutions, for example - https://serversforhackers.com/video/installing-php-7-with-memcached
You can try to adapt it to your case, at least.
Something like:

# yum install make plesk-php70-devel gcc glibc-devel libmemcached-devel zlib-devel git
# git clone https://github.com/php-memcached-dev/php-memcached.git
# cd php-memcached/
# git checkout php7
# /opt/plesk/php/7.0/bin/phpize
# ./configure --disable-memcached-sasl --with-php-config=/opt/plesk/php/7.0/bin/php-config
# make && make install

And then as in the article on devblog.
You can try, at least, with my direction :)

Hi,
it's ok for Centos 7.2 and php 7.0.13 and plesk 17.0.17 ?
 
Yes, it should work.

# yum install make plesk-php70-devel gcc glibc-devel libmemcached-devel zlib-devel git
# git clone https://github.com/php-memcached-dev/php-memcached.git
# cd php-memcached/
# git checkout php7
# /opt/plesk/php/7.0/bin/phpize
# ./configure --disable-memcached-sasl --with-php-config=/opt/plesk/php/7.0/bin/php-config
# make && make install

I have just completed the above commands.

But I can not find in the php options to check: memcached

Should I also do the following ? :

# echo "extension=memcached.so" > /opt/plesk/php/7.0/etc/php.d/memcached.ini
# plesk bin php_handler --reread
 
# yum install make plesk-php70-devel gcc glibc-devel libmemcached-devel zlib-devel git
# git clone https://github.com/php-memcached-dev/php-memcached.git
# cd php-memcached/
# git checkout php7
# /opt/plesk/php/7.0/bin/phpize
# ./configure --disable-memcached-sasl --with-php-config=/opt/plesk/php/7.0/bin/php-config
# make && make install

I have just completed the above commands.

But I can not find in the php options to check: memcached

Should I also do the following ? :

# echo "extension=memcached.so" > /opt/plesk/php/7.0/etc/php.d/memcached.ini
# plesk bin php_handler --reread

Can these commands compatible with PHP7.1?
If yes, which variables I have to change if I want to apply these commands for it?
 
Back
Top