
centos安装memcached和PHP php-pecl-memcached.x86_64
发布日期:2021-05-09 07:59:30
浏览次数:15
分类:博客文章
本文共 565 字,大约阅读时间需要 1 分钟。
安装memcached
sudo yum install memcached.x86_64
安装php-pecl-memcached
php memcache有两个实现类
php-pecl-memcache.x86_64 : Extension to work with the Memcached caching daemonphp-pecl-memcached.x86_64 : Extension to work with the Memcached caching daemon
我们需要装
sudo yum install php-pecl-memcached.x86_64
否则,在PHP中会报错
Fatal error: Class 'Memcache' not found
启动memcached并测试php
sudo service memcached stopsudo service memcached start
新建php-mem.php
connect("localhost", 11211);$mem->set('ryan', 'Miao', 0, 60);$ryan = $mem->get('ryan');echo $ryan;?>
执行
php php-memcache.php Miao