centos6下安装php7的memcached扩展
安装php7的memcached扩展 1.编译安装libmemcached-1.0.18 wget https://launchpadlibrarian.net/165454254/libmemcached-1.0.18.tar.gztar -zxvf libmemcached-1.0.18.tar.gz cd libmemcached-1.0.18 ./configure --prefix=/usr/local/libmemcached --with-memcached make && make install2. 安装php-memcached扩展 php使用memcache的扩展有两个,一个memcache,一个memcached,前者比较老,推荐使用第二个,我们这里以第二个为例:在github上找到适用于php7的分支(https://github.com/php-memcached-dev/php-memcached/tree/php7),同样使用wget下载zip压缩包,解压缩,进入目录,依次执行下列命令(其中php-config和libmemcached目录根据具体情况设定,可以使用whereis或者find来查找 # 解压 cd php-memcached-php7# 执行phpize会生成configure文件 /usr/local/php/bin/phpize # 执行预编译 ./configure --enable-memcached --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --disable-memcached-sasl make make install[root@szxxlfhtest02t:/usr/local/src/php-memcached-php7]# /usr/local/php/bin/phpize Configuring for: PHP Api Version: 20151012 Zend Module Api No: 20151012 Zend Extension Api No: 320151012[root@szxxlfhtest02t:/usr/local/src/php-memcached-php7]# make install Libraries have been installed in:/usr/local/src/php-memcached-php7/modulesIf you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following:- add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution- add LIBDIR to the `LD_RUN_PATH' environment variable during linking- use the `-Wl,--rpath -Wl,LIBDIR' linker flag- have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ----------------------------------------------------------------------Build complete. Don't forget to run 'make test'. Installing shared extensions: /usr/local/php-7.0.12_fpm/lib/php/extensions/no-debug-non-zts-20151012/修改php.ini的配置 加上:extension_dir="/usr/local/php7.1/lib/php/extensions/no-debug-non-zts-20160303/"(每个人的路径可能不一样)extension = "memcached.so 重启php-fpm3. 修改php.ini文件 (php.ini文件具体位置可以通过phpinfo()函数来查看到),在php.ini文件之中加入下面这句:# vim /usr/local/php-7.0.12_fpm/lib/php.ini extension_dir="/usr/local/php-7.0.12_fpm/lib/php/extensions/no-debug-non-zts-20151012/" extension=memcached.so[root@szxxlfhtest02t:~]# php -m [PHP Modules] bz2 calendar Core ctype curl date dba dom exif fileinfo filter ftp gd gettext hash iconv json ldap libxml mbstring mcrypt memcache memcached4.测试是否安装成功[root@szxxlfhtest02t:/data/www/vhosts/cmstest.chinasoft.com/httpdocs]# cat mem.php <?php$mem = new Memcached(); //创建一个memcached对象 $mem->addServer('127.0.0.1',11211); //连接memcached $mem->set("key","test");//设置一个变量到内存中,名称是key 值是test $get_value = $mem->get('key'); //从内存中取出key的值 if($mem->getResultCode() == Memcached::RES_NOTFOUND) //如果该名称的变量没有设置 {echo 'not set!'; } else {echo $get_value; }***************************[root@newcms:/data/www/cms/cmsx.chinasoft.com.wx/httpdocs/public]# cat /usr/local/nginx/conf/cms.d/cmsx.chinasoft.com.wx.conf server {listen 80;server_name cmsx.chinasoft.com.wx cmsx.chinasoft.com.wx.wx;access_log /data/www/logs/nginx_log/access/cmsx.chinasoft.com.wx_access.log main ;access_log on;error_log /data/www/logs/nginx_log/error/cmsx.chinasoft.com.wx_error.log ;root /data/www/cms/cmsx.chinasoft.com.wx/httpdocs/public/;index index.html index.shtml index.php ;include rewrite.d/cmsx.chinasoft.com.wx.conf ;error_page 404 403 /404.html; access_log on;#location / {# expires -1;# proxy_pass http://php_pool; # include proxy_params;#}#location / {# index index.php index.html index.htm;# try_files $uri $uri/ /index.php?$query_string;#}#location ~ \.php$ {# fastcgi_pass unix:/tmp/php-cgi.sock;# fastcgi_index index.php;# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;# include fastcgi_params;#}location / {index index.php index.html index.htm;if (!-e $request_filename) {rewrite . /index.php last;}}location ~ \.php$ {fastcgi_pass unix:/tmp/php-cgi.sock;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}}
转载于:https://www.cnblogs.com/reblue520/p/9643572.html
centos6下安装php7的memcached扩展相关推荐
- PHP7 下安装 memcache 和 memcached 扩展
转载自:https://www.jianshu.com/p/c06051207f6e Memcached 是高性能的分布式内存缓存服务器,而PHP memcache 和 memcached 都是 Me ...
- php imap 安装_linux 下安装PHP的IMAP扩展实现邮件收发
系统CentOS 6.5 PHP5.5.19 1.安装imap的依赖包: [root@iZ9482lp6yqZ]# yum install -y libc-client-* 没有安装编译错误提示: c ...
- centos 6 php环境,centos6.6 下 安装 php7 + nginx环境的方法
本文实例讲述了centos6.6 下 安装 php7 + nginx环境的方法.分享给大家供大家参考,具体如下: 1.安装必要的依赖库 > yum -y install gd zlib libj ...
- mac php7 mysql.so_mac下安装php7详解
本文主要为大家介绍一下mac 下安装php7全过程.具有很好的参考价值,希望对大家有所帮助.一起跟随小编过来看看吧,希望能帮助到大家. 更新系统库 yum -y install gcc gcc-c++ ...
- php memcached 扩展下载,编译安装 PHP 的 Memcached 扩展
image.png 前面章节我会先简要说明一下安装过程, 后面章节我会记录在安装期间踩过的坑. Linux 下编译软件的步骤参见Linux 编译软件的步骤 服务器环境 CentOS 7 PHP 7.0 ...
- yum 安装php7和相关扩展
[radhat yum 源] rpm -aq|grep yum|xargs rpm -e --nodeps wget http://mirrors.163.com/centos/6/os/x86_64 ...
- Mysql系列三:Centos6下安装Mysql和Mysql主从复制的搭建
一.Centos6下安装Mysql 检测下系统有没有自带的mysql:yum list installed | grep mysql, 如果已经有的话执行命令yum -y remove mysql- ...
- php7 apache mysql_Windows下安装php7+Apache2.4+MySQL
因为学习需要,所以在Windows下安装php7+Apache2.4+MySQL 1.安装Apache 到官网下载Apache2.4 ,选择Windows版本,这里本人下载2.4版本 下载之后解压 修 ...
- phpst安装memcache扩展_在 Ubuntu/Debian 下安装 PHP7.3 教程
介绍 最近的 PHP 7.3.0 已经在 2018 年12月6日 发布 GA,大家已经可以开始第一时间体验新版本了,这里先放出 PHP7.3 安装的教程以便大家升级. 适用系统: Ubuntu 18. ...
最新文章
- 1073 Scientific Notation
- 1.3. PostgreSQL 官方 YUM 源安装
- java最全基础知识_Java编程入门,计数排序(Counting Sort)怎么做?
- CSU1323: ZZY and his little friends
- 强化学习——Qlearning
- Python 列表元组字典集合
- Mysql显示创建表的sql语句
- 21适配器模式(Adapter Pattern)
- F问题3-7:以太网使用载波监听多点接入碰撞检测协议CSMA/CD。频分复用FDM才使用载波。以太网有没有使用频分复用?...
- 剑指offer题目系列二
- MacBook安装Mysql
- 国产CAM究竟水平如何?看完测试我震惊了
- 超高频RFID智慧酒店管理系统解决方案
- 大前研一,柳井正《放胆去闯》读书笔记
- Python爬虫-IP隐藏技术与代理爬取
- JQuery获取选中的元素(单选框复选框)及其他等
- 数论——卢卡斯(Lucas)定理(板子)
- 渡一教育公开课web前端开发JavaScript精英课学习笔记(二)变量类型,运算符
- SAP中分配和分摊的区别
- 详解CAN总线:CAN总线故障界定与管理