The centos system installs the memcached extension steps for php

  • 2020-05-07 20:48:51
  • OfStack

1. Install via yum


yum -y install memcached
# Execute after installation is complete :
memcached -h
# appear memcached The help information indicates that the installation was successful 

2. Join the startup service


chkconfig --level 2345 memcached on

3. The configuration Memcached


vim /etc/sysconfig/memcached
# The contents of the file are as follows, modified as required :
PORT="11211" # port 
USER="root" # The user name 
MAXCONN="1024" # Maximum number of connections 
CACHESIZE="64" # Memory size 
OPTIONS="" # Additional parameters 

4. Install libmemached


wget https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz
tar -zxvf libmemcached-1.0.16.tar.gz
cd libmemcached-1.0.16
./configure -prefix=/usr/local/libmemcached -with-memcached
make && make install

5. Install php - devel


yum install php-devel

6. Install the PHP Memcached extension


wget http://pecl.php.net/get/memcached-2.1.0.tgz
tar -zxvf memcached-2.1.0.tgz
cd memcached-2.1.0
/usr/local/php/bin/phpize
./configure -enable-memcached -with-php-config=/usr/local/php/bin/php-config -with-zlib-dir -with-libmemcached-dir=/usr/local/libmemcached -prefix=/usr/local/phpmemcached
make && make install


Related articles: