Home >Backend Development >PHP Tutorial >php-memcached extension installation

php-memcached extension installation

不言
不言Original
2018-04-26 11:48:293717browse

The content of this article is about php-memcached extension installation, which has certain reference value. Now I share it with everyone. Friends in need can refer to it

[libmemcached installation 】

# wget https://launchpadlibrarian.net/165454254/libmemcached-1.0.18.tar.gz
# tar -zxvf libmemcached-1.0.18.tar.gz
# cd libmemcached-1.0.18
# ./configure --prefix=/usr/local/libmemcached --with-memcached
# make && make install

php-memcachedINSTALL】

# wget https://pecl.php.net/get/memcached-3.0.4.tgz
# mv memcached-3.0.4.tgz php-memcached-3.0.4.tgz
# tar -zxvf php-memcached-3.0.4.tgz
# mv memcached-3.0.4 php-memcached-3.0.4
# cd php-memcached-3.0.4
# /usr/local/php/bin/phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached/ --disable-memcached-sasl
# make && make install

修改php.ini文件

添加一行:
[memcached]
extension = memcached.so
重启php-fpm:kill -USR2 `cat /usr/local/php/var/run/php-fpm.pid`

php test

$m = new Memcached();
$m->addServer('127.0.0.1','11211');
print_r($m->getStats());

Related recommendations:

php-redis extension installation (phpredis)


The above is the detailed content of php-memcached extension installation. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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