我正在尝试设置memcached在运行 RedHat PHP 5.6.25 的服务器上
我已经成功安装内存缓存但找不到如何安装memcached- 有可用的软件包吗?如果没有,我该如何获取?
我努力了:
yum install php56w-pecl-memcached
yum install rh-php56-php-pecl-memcached
yum install rh-php56-php-memcached
但这些都不正确 - 第一次安装memcached但不适用于 RedHat,并且后两个不是正确的包。
有解决方法吗?
答案1
你必须编译它,我还没找到可用的。我当时也遇到了同样的情况,使用的是 sclo/schrh repo,httpd 2.4 和 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