Home > Backend Development > PHP Tutorial > How to install memcached extension for php in centos system

How to install memcached extension for php in centos system

coldplay.xixi
Release: 2023-04-09 08:22:02
forward
2683 people have browsed it

How to install memcached extension for php in centos system

1. Install through yum

The code is as follows:

yum -y install memcached
#安装完成后执行:
memcached -h
#出现memcached帮助信息说明安装成功
Copy after login

2. Join the startup service

The code is as follows:

chkconfig --level 2345 memcached on
Copy after login

3. Configure Memcached

The code is as follows:

vim /etc/sysconfig/memcached
#文件中内容如下,按需要修改:
PORT="11211" #端口
USER="root" #用户名
MAXCONN="1024" #最大连接数
CACHESIZE="64" #内存大小
OPTIONS="" #附加参数
Copy after login

4. Install libmemached

The code is as follows:

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
Copy after login

5. Install php-devel

The code is as follows:

yum install php-devel
Copy after login

6. Install PHP Memcached extension

The code is as follows:

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
Copy after login

Related learning recommendations : PHP programming from entry to proficiency

The above is the detailed content of How to install memcached extension for php in centos system. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:jb51.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template