由于前文“Centos 7.2 yum安装php7”中升级了php到php7,导致之前可以正常使用的phpmyadmin、memcache等无法继续使用,需要重新编译安装,memcache目前未找到有效的解决方法,只好重新安装memcached来替代之前的memcache。此处介绍memcached的安装编译。

1、试图按以前的经验,直接升级memcache:

[root@iZ23d ~]# pecl upgrade memcache
bash: pecl: command not found...

根据这边的提示,需要安装相应的 yum install php-devel php-pear httpd-devel

[root@iZ23d ~]# yum install php70w-devel php70w-pear php70w-httpd-devel  
Loaded plugins: langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
。。。。    【其中省略】
Warning: RPMDB altered outside of yum.
Installing : php70w-process-7.0.0-1.w7.x86_64                                           1/4
Installing : php70w-xml-7.0.0-1.w7.x86_64                                               2/4
Installing : 1:php70w-pear-1.10.1-1.w7.noarch                                           3/4
Installing : php70w-devel-7.0.0-1.w7.x86_64                                             4/4
Verifying  : php70w-devel-7.0.0-1.w7.x86_64                                             1/4
Verifying  : php70w-xml-7.0.0-1.w7.x86_64                                               2/4
Verifying  : 1:php70w-pear-1.10.1-1.w7.noarch                                           3/4
Verifying  : php70w-process-7.0.0-1.w7.x86_64                                           4/4
Installed:
php70w-devel.x86_64 0:7.0.0-1.w7              php70w-pear.noarch 1:1.10.1-1.w7
Dependency Installed:
php70w-process.x86_64 0:7.0.0-1.w7              php70w-xml.x86_64 0:7.0.0-1.w7
Complete!

继续按偷懒的方法升级:

[root@iZ23d ~]#  pecl upgrade memcache 
downloading memcache-2.2.7.tgz ...
Starting to download memcache-2.2.7.tgz (36,459 bytes)
.....done: 36,459 bytes
11 source files, building
running: phpize
Configuring for:
PHP Api Version:         20151012
Zend Module Api No:      20151012
Zend Extension Api No:   320151012

。。。  【其中省略】

config.status: executing libtool commands
running: make
/bin/sh /var/tmp/pear-build-rootEb5cjP/memcache-2.2.7/libtool --mode=compile cc -I/usr/include/php -I. -I/var/tmp/memcache -DPHP_ATOM_INC -I/var/tmp/pear-build-rootEb5cjP/memcache-2.2.7/include -I/var/tmp/pear-build-rootEb5cjP/memcache-2.2.7/main -I/var/tmp/memcache -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /var/tmp/memcache/memcache.c -o memcache.lo
libtool: compile:  cc -I/usr/include/php -I. -I/var/tmp/memcache -DPHP_ATOM_INC -I/var/tmp/pear-build-rootEb5cjP/memcache-2.2.7/include -I/var/tmp/pear-build-rootEb5cjP/memcache-2.2.7/main -I/var/tmp/memcache -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /var/tmp/memcache/memcache.c  -fPIC -DPIC -o .libs/memcache.o
/var/tmp/memcache/memcache.c:40:40: fatal errorext/standard/php_smart_str.h: No such file or directory
#include "ext/standard/php_smart_str.h"
^
compilation terminated.
make: *** [memcache.lo] Error 1     
ERROR: `make' failed   

说明升级失败,缺乏 php_smart_str.h 文件,查看是否有相应文件的源文件:

[root@iZ23d ~]# find / -name php_smart_str.h
/root/php-5.4.16/ext/standard/php_smart_str.h

以上说明 php5中有相应的文件,但是已经下载并解压的 php7源安装包中却没有相应文件,而 这边前人的经验也表面,可能是Php7本身的某些扩展未做到位。

而根据这边的说法,之前版本的php中的 php_smart_str.h 在 php7 中已经改名为 php_smart_string.h ;

查看相应的文件:

[root@iZ23d ~]# find / -name php_smart_string.h    
/usr/include/php-zts/php/ext/standard/php_smart_string.h
/usr/include/php/ext/standard/php_smart_string.h
/root/php-7.0.1RC1/ext/standard/php_smart_string.h

的确有相应的文件,但是,尝试把相应的文件拷贝一份并命名为相应的 php_smart_str.h 后,重新升级编译安装,并不能解决问题。

在github和stackoverflow均看到此问题暂时没有解决方案,只能等Php7完善。不得已,只能放弃。

在寻找memcache解决方案的过程中,发现memcached碰到的问题几乎和memcache一样,但是,却从 stackoverflow 找到一个可行的 memcached 安装方法,并证实有效。下面是具体的过程。

第一步,直接git clone:

[root@iZ23d ~]# git clone https://github.com/php-memcached-dev/php-memcached   
Cloning into 'php-memcached'...
remote: Counting objects: 2965, done.
remote: Total 2965 (delta 0), reused 0 (delta 0), pack-reused 2965
Receiving objects: 100% (2965/2965), 931.47 KiB | 8.00 KiB/s, done.
Resolving deltas: 100% (1774/1774), done.

第二步:

[root@iZ23d ~]# cd php-memcached   
[root@iZ23d php-memcached]# git checkout php7    
Branch php7 set up to track remote branch php7 from origin.
Switched to a new branch 'php7'

第三步:

[root@iZ23d php-memcached]# phpize  
Configuring for:
PHP Api Version:         20151012
Zend Module Api No:      20151012
Zend Extension Api No:   320151012

第四步:configure

[root@iZ23d php-memcached]# ./configure

checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
。。。 【省略部分】
checking for memcached session support... enabled
checking for memcached igbinary support... disabled
checking for memcached msgpack support... disabled
checking for libmemcached location... configure: errormemcached support requires libmemcached. Use --with-libmemcached-dir=<DIR> to specify the prefix where libmemcached headers and library are located

第五步:根据错误提示,重新  configure  :

先找到相应文件:

[root@iZ23d php-memcached]#find / -name libmemcached  
/usr/local/libmemcached
/usr/local/libmemcached/include/libmemcached
/root/libmemcached-1.0.18/libmemcached

根据文件位置,增加参数 configure    :

[root@iZ23d php-memcached]# ./configure --with-libmemcached-dir=/usr/local/libmemcached
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
。。。
checking for sasl/sasl.h... yes
checking whether libmemcached supports sasl... no
configure: error: no, libmemcached sasl support is not enabled. Run configure with --disable-memcached-sasl to disable this check

再根据新提示,继续:

[root@iZ23d php-memcached]# ./configure --with-libmemcached-dir=/usr/local/libmemcached  --disable-memcached-sasl
checking for grep that handles long lines and -e... /usr/bin/grep
。。。
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands

终于未出现错误提示!

第六步,make:

[root@iZ23d php-memcached]# make    
/bin/sh /root/php-memcached/libtool --mode=compile cc -I/usr/include/php    -I. -I/root/php-memcached -DPHP_ATOM_INC -I/root/php-memcached/include -I/root/php-memcached/main -I/root/php-memcached -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/libmemcached/include  -DHAVE_CONFIG_H  -g -O2   -c /root/php-memcached/php_memcached.c -o php_memcached.lo
libtool: compile:  cc -I/usr/include/php -I. -I/root/php-memcached -DPHP_ATOM_INC -I/root/php-memcached/include -I/root/php-memcached/main -I/root/php-memcached -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/libmemcached/include -DHAVE_CONFIG_H -g -O2 -c /root/php-memcached/php_memcached.c  -fPIC -DPIC -o .libs/php_memcached.o
。。。。。 【省略部分】
libtool: install: cp ./.libs/memcached.so /root/php-memcached/modules/memcached.so
libtool: install: cp ./.libs/memcached.lai /root/php-memcached/modules/memcached.la
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/java/jdk1.8.0_45:/root/bin:/sbin" ldconfig -n /root/php-memcached/modules
----------------------------------------------------------------------
Libraries have been installed in:
/root/php-memcached/modules
If 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'.

根据提示,继续 make test :

[root@iZ23d php-memcached]# make test    
Build complete.
Don't forget to run 'make test'.
。。。【省略部分】
Thank you for helping to make PHP better.

第七部, make install 

[root@iZ23d php-memcached]# make install   
Installing shared extensions:     /usr/lib64/php/modules/
第八步,重启 Apache,在/etc/php.ini 的最后添加 extension="memcached.so",保存退出,重启Apache :
[root@iZ23d php-memcached]# cd ..
[root@iZ23d  ~]# systemctl restart httpd.service
第九步,验证检查 memcached 安装结果:
查看 php 版本,看看会否报错,若报错,说明 memcached 安装错误,否则多半表示安装成功: 
[root@iZ23d ~]# php -v 
PHP 7.0.0 (cli)(built: Dec  2 2015 20:42:32) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
以上结果说明,memcached安装成功。
查看phpinfo,已经显示memcached的扩展内容,内容展示如下:

memcached

memcached support enabled
Version 2.2.0
libmemcached version 1.0.18
SASL support no
Session support yes
igbinary support no
json support no
msgpack support no
Directive Local Value Master Value
memcached.compression_factor 1.3 1.3
memcached.compression_threshold 2000 2000
memcached.compression_type fastlz fastlz
memcached.serializer php php
memcached.sess_binary 0 0
memcached.sess_connect_timeout 1000 1000
memcached.sess_consistent_hash 0 0
memcached.sess_lock_expire 0 0
memcached.sess_lock_max_wait 0 0
memcached.sess_lock_wait 150000 150000
memcached.sess_locking 1 1
memcached.sess_number_of_replicas 0 0
memcached.sess_prefix memc.sess.key. memc.sess.key.
memcached.sess_randomize_replica_read 0 0
memcached.sess_remove_failed 0 0
memcached.store_retry_count 2 2
再次证明 memcached 安装成功!
第十步,启动 memcached :
[root@iZ23d ~]# systemctl start memcached.service   
查看状态:
[root@iZ23d ~]# systemctl status memcached.service  
● memcached.service - Memcached
Loaded: loaded (/usr/lib/systemd/system/memcached.service; disabled; vendor preset: disabled)
Active: active (running) since Mon 2015-12-21 19:55:07 CST; 14s ago
Main PID: 1426 (memcached)
CGroup: /system.slice/memcached.service
└─1426 /usr/bin/memcached -u memcached -p 11211 -m 64 -c 1024
Dec 21 19:55:07 iZ23d2e6hoqZ systemd[1]: Started Memcached.
Dec 21 19:55:07 iZ23d2e6hoqZ systemd[1]: Starting Memcached...
设置开机启动:
[root@iZ23d ~]# systemctl enable  memcached.service  
Created symlink from /etc/systemd/system/multi-user.target.wants/memcached.service to /usr/lib/systemd/system/memcached.service.

Centos 7.2 及php7环境下升级memcache未果,改安装 memcached相关推荐

  1. PHP7不能用string类名,thinkphp在php7环境下提示Cannot use ‘String’ as class name as it is reserved的解决方法...

    这篇文章主要介绍了thinkphp在php7环境下提示Cannot use 'String' as class name as it is reserved的解决方法,涉及thinkPHP针对php7 ...

  2. 手把手教你在Windows环境下升级R

    在Windows环境下,我们可以使用installr包自动将R升级到最新版本.并且可以安装软件.下面主要演示如何在Windows环境下升级R,并将旧版本安装的R包复制到更新版本的R. 1.加载inst ...

  3. 震惊,与gcc不得不说的故事:Linux虚拟机环境下,gcc的在线安装

    目录 Linux虚拟机环境下,gcc的在线安装 在线安装 yum在线安装指令 进入root账户 安装gcc 检查安装情况 最后 小白一枚,有问题请提一下,谢谢啦,多多包涵 在线安装 使用yum安装,注 ...

  4. 【Rhapsody学习笔记(二)】Linux环境下的Rhapsody集成引擎安装部署

    Rhapsody的安装部署包括Rhapsody引擎的部署(服务端),以及Rhapsody IDE(客户端)的安装部署,其中,IDE可以安装在多台不同的windows客户机上,本文仅介绍CentOS7环 ...

  5. mysql8.0卸载出现问题,Windows环境下MySQL 8.0 的安装、配置与卸载

    软件版本 Windows:Windows10 MySQL:mysql-8.0.17-winx64.zip 安装步骤 1.配置环境变量 2.新建my.ini文件 文件位置:C:\Program File ...

  6. 安装mysql8.0配置环境_Windows环境下MySQL 8.0 的安装、配置与卸载

    软件版本 Windows:Windows10 MySQL:mysql-8.0.17-winx64.zip 安装步骤 1.配置环境变量 name:Path value:C:\Program Files\ ...

  7. python2.7安装教程win7_win7 64位环境下,为python2.7 安装pip

    第一步: 安装python并配置好环境变量 第二步: 下载setuptools源码setuptools-38.5.1.zip,地址:https://pypi.python.org/pypi/setup ...

  8. mysql8.0.13安装不_Windows环境下MySql8.0.13的安装及常见问题解决方案

    Windows环境下MySql8.0.13的安装及常见问题解决方案 目录 一.引文 二.下载地址 三.安装步骤 3.1.文件解压 3.2.新建并修改my.ini文件 3.3.配置环境变量 3.4.以管 ...

  9. linux环境下questasim 10.7的安装步骤

    linux环境:centos6.8系统 Questasim 10.7安装包 questasim_10.7_linux64.part2.rar_questasim_10.7_linux64-Linux文 ...

最新文章

  1. Crontab使用语法格式
  2. 用惯C#再用C++的一些麻烦事
  3. 【在线报表设计】提升报表外观的15个技巧
  4. 【转】VS编译环境命令窗口中的命令
  5. 刘兴亮印象中的李开复
  6. Android仿苹果版QQ下拉刷新实现(二) ——贝塞尔曲线开发鼻涕下拉粘连效果
  7. findContours函数参数详解
  8. 计算机识别外设原理,车牌识别系统的识别原理及触发方式
  9. 阿里互联互通再下一城,开放生态缔造新的产业蓝海?
  10. excel文件服务器未响应,excel打不开文件未响应怎么处理-处理excel无法打开文件未响应的方法 - 河东软件园...
  11. 磊科Netcore路由器无线无缝中继(桥接)设置方法
  12. 简述er图的作用_ER图的理解
  13. 上焦如雾实际上是指何项作用_广西中医药大学赛恩斯新医药学院《中医基础理论》期考试卷卷16...
  14. 如何消除你的情绪、戾气与恶念
  15. c/c++中的转义字符
  16. 怎样压缩PDF文件体积?
  17. ATF快速扫盲(Quick Start)
  18. srm安全擦除Linux敏感文件,你受得了吗?-尚文网络xUP楠哥
  19. jmeter断言2个变量的值相等
  20. 阿里巴巴iDST+阿里视频云:计算机视觉和机器学习在消费级视频中的应用

热门文章

  1. POI-EXCEL导入导出工具
  2. 解决sudo pacman -S archlinuxcn-keyring 报错
  3. 操作系统的基本类型及其特点
  4. L1-057 PTA使我精神焕发 (5 分)C语言
  5. 空白单页面html,8款HTML即将上线(Coming Soon)单页面Leading Page模板
  6. 《精进:如何成为一个很厉害的人》读书笔记
  7. 打开虚拟机时出现不能为虚拟电脑打开一个新任务
  8. 我是如何实现「朋友圈图片评论」的?
  9. 管理铁律:高层唱白脸,中层扮黑脸
  10. 世界杯八强即将出炉,iModeluus助您知晓赛果!