PHP安装memcache扩展的步骤讲解
2019-02-15 00:21
826 查看
PHP 5.6.23,查询目前最稳定的版本是memcache-2.2.7。
1.下载并解压缩。
wget http://pecl.php.net/get/memcache-2.2.7.tgz
tar zxvf memcache-2.2.7.tgz
2. 编译。根据实际情况使用phpize和php-config。
[root@www memcache-2.2.7]# /usr/local/php/bin/phpize Configuring for: PHP Api Version: 20131106 Zend Module Api No: 20131226 Zend Extension Api No: 220131226
[root@www memcache-2.2.7]# ./configure --enable-memcache --with-php-config=/usr/local/php/bin/php-config
3.安装。make;make install
[root@www memcache-2.2.7]# make install Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
4.修改php.ini(添加 extension=memcache.so)并重启php-fpm。
下面在linux下测试一下php与memcache的连接性。假设memcached服务器侧就在127.0.0.1。生成op_mem.php文件,代码如下:
<?php $memcache = new Memcache; $memcache->connect('127.0.0.1',11211) or die("Could not connect Mc server"); $memcache->set('key','oldboy book'); $get= $memcache->get('key'); echo $get; ?>
执行该文件,返回相应取值:
[root@www bbs]# /usr/local/php/bin/php op_mem.php oldboy book
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对脚本之家的支持。如果你想了解更多相关内容请查看下面相关链接
您可能感兴趣的文章:
相关文章推荐
- PHP Memcache扩展安装配置步骤
- PHP安装sqlsrv和memcache扩展步骤
- PHP安装memcache扩展接口步骤
- 关于php编译安装扩展模块memcache的问题
- [PHP]PHP中memcache扩展的安装
- windows下php5.4.16安装redis和memcache扩展
- php安装memcache扩展
- Linux下的Memcache安装及安装Memcache的PHP扩展安装
- Linux 安装基于(PHP5.5)memcache扩展
- Centos下mysql,apache,php安装详细步骤(redis+memcache+APC)
- windwos下安装php的memcache扩展
- linux下安装php扩展memcache
- Linux下php安装memcache扩展
- Linux下php安装memcache扩展
- windows下的php的memcache扩展的安装及memcache最新下载地址
- CentOS环境PHP安装memcache扩展
- Linux安装php扩展memcache
- mecache安装与php_memcache.dll扩展
- php通过pecl方式安装扩展的实例讲解
- PHP之PDO_MYSQL扩展安装步骤