PHP 8.4.2 Released!

安装

安装此 PECL 扩展相关的信息可在手册中标题为 PECL 扩展的安装章节中找到。更多信息如新的发行版本、下载、源文件、 维护人员信息及变更日志等,都在此处: » https://pecl.php.net/package/memcached.

如果 libmemcached 被安装在一个非标准路径,使用 --with-libmemcached-dir=DIR 来指定路径,DIR 就是 libmemcached 安装时的 prefix 参数。这个路径需要包含文件 include/libmemcached/memcached.h

如果要支持压缩就需要 zlib。对于非标准安装的 zlib 库,使用 --with-zlib-dir=DIR 来指定 zlib 安装路径,DIR 就是 zib 安装时的 prefix 参数。

session 处理程序的支持默认是开启的。如果要关闭它,使用选项 --disable-memcached-session

默认情况下禁用 SASL 身份验证支持。要启用,请使用 --enable-memcached-sasl。这要求已安装 libsasl2,并且已在启用 SASL 支持的情况下构建 libmemcached。

添加备注

用户贡献的备注 4 notes

up
98
qeremy [at] gmail [dot] com
12 years ago
Do not lose your time to install it on Ubuntu just trying "sudo apt-get install php5-memcached". There is something you need to do that sure installing memcached. Anyway...

Step 1.
$ sudo apt-get install memcached
Step 2.
$ sudo apt-get install php5-memcached
Step 3.
$ sudo /etc/init.d/apache2 restart

Ready!

What about some test?

<?php
error_reporting
(E_ALL & ~E_NOTICE);

$mc = new Memcached();
$mc->addServer("localhost", 11211);

$mc->set("foo", "Hello!");
$mc->set("bar", "Memcached...");

$arr = array(
$mc->get("foo"),
$mc->get("bar")
);
var_dump($arr);
?>

Hoping to help someone.
~Kerem
up
12
info at kgsw dot de
5 years ago
For PHP 7 seems to work:

$ sudo apt-get install memcached
$ sudo apt-get install php-memcached
$ sudo apachectl graceful

## php 7.2.19 / ubuntu 18.04.1

$mc = new Memcached();
$mc->addServer("localhost", 11211);
...
up
6
petermiller1986 att gmail dotttttttt com
12 years ago
i'm planning on using membase for my website and i was really struggling to install the memcashed php client on ubuntu with pear, but actually there is an easier way:

$ sudo apt-get install php5-memcached

you dont even need to install the membase server first - this can be done afterwards. hope this helps someone!
up
0
Clint Priest
15 years ago
If your server has --enable-json=shared as mine did, this extension requires you to have extension=json.so to load properly.
To Top