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,415
bhttoan
  • 650

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