0

I am trying to setup memcached on a server running RedHat PHP 5.6.25

I have successfully installed memcache but cannot find how to install memcached - is there a package available? If not how can I get it?

I have tried:

yum install php56w-pecl-memcached
yum install rh-php56-php-pecl-memcached
yum install rh-php56-php-memcached

but none of these are correct - the first installs memcached but not for RedHat and the second two are not correct packages.

Is there a workaround?

Thomas
  • 4,155
  • 5
  • 21
  • 28
bhttoan
  • 620
  • 3
  • 15
  • 26
  • What do you mean by "RedHat PHP 5.6.25"? Exactly what did you install? – Michael Hampton Mar 10 '17 at 18:37
  • I did not install it but this is what is in use https://www.softwarecollections.org/en/scls/rhscl/rh-php56/ along with https://www.softwarecollections.org/en/scls/rhscl/httpd24/ for Apache – bhttoan Mar 10 '17 at 18:41
  • They have it in the PHP 7 software collection but not in the PHP 5.6 software collection. Consider upgrading; 5.6 is getting old anyway. – Michael Hampton Mar 10 '17 at 18:44
  • See https://blog.remirepo.net/post/2017/02/23/Additional-PHP-packages-for-RHSCL but indeed "memcached" extension is only available for rh-php70. – Remi Collet Apr 14 '17 at 06:30

1 Answers1

0

You have to compile it, I haven't found any available. I was in the same scenario using sclo/schrh repo with httpd 2.4 and php 5.6.25

# I'm assuming you already have php installed via rpm using CentOS6 scl repo

# Install required packages for compiling
yum install cyrus-sasl-devel zlib-devel gcc-c++ -y

# compile the required package for memcached php module
mkdir /tmp/src  
cd /tmp/src
curl -L -O 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

# install php-memcached module using pecl ( I'm assuming the default pecl is the right one, if not use "find / -name "pecl" to use the correct bin )
echo "no" | pecl install memcached-2.2.0
chmod +x -R /opt/rh/rh-php56/root/usr/lib64/php/modules
echo "extension=memcached.so" >> /etc/opt/rh/rh-php56/php.d/40-memcached.ini
chmod 644 /etc/opt/rh/rh-php56/php.d/40-memcached.ini

# check if module is installed
php -m