欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php-memcached扩展安装

程序员文章站 2022-03-11 18:30:22
...
这篇文章介绍的内容是关于php-memcached扩展安装,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下

【libmemcached安装】

# 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-memcached安装】

# 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测试

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

相关推荐:

php-redis扩展安装(phpredis)

以上就是php-memcached扩展安装的详细内容,更多请关注其它相关文章!