Centos下Yum安装PHP5.5,5.6

默认的版本太低了,手动安装有一些麻烦,想采用Yum安装的可以使用下面的方案:
* 检查当前安装的PHP

yum list installed | grep php

如果有安装的PHP包,先删除他们

 yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64

安装webtatic平台

  • Centos 5.X rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm
  • CentOs 6.x rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
  • CentOs 7.X rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

如果想删除上面安装的包,重新安装

rpm -qa | grep webstatic
rpm -e  上面搜索到的包即可

基于webtatic安装php

yum install php55w.x86_64 php55w-cli.x86_64 php55w-common.x86_64 php55w-gd.x86_64 php55w-ldap.x86_64 php55w-mbstring.x86_64 php55w-mcrypt.x86_64 php55w-mysql.x86_64 php55w-pdo.x86_64
yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64

注:如果想升级到55w把上面的55w换成56w就可以了。

基于webtatic安装php-fpm

yum install php55w-fpm

注:如果想升级到55w把上面的55w换成56w就可以了。

安装问题

yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel mysql pcre-devel
安装libxml2时出现xz compression not available错误
* 输入如下指令删除错误`epel`包
```
yum remove epel-release
```
说明:中间提示时 输入 :`y (yes)`  

* 输入如下指令清理缓存  
```
rm -rf /var/cache/yum/x86_64/6Server/epel/
```
* 再次执行相关指令即可。
php安装错误 configure: error: Please reinstall the libcurl distribu
yum -y install curl-devel

收集的一些其它源安装遇到的问题

  1. configure: error: xml2-config not found. Please check your libxml2 installation.

    yum install libxml2-devel
    
  2. configure: error: Cannot find OpenSSL’s

    yum install openssl-devel
    
  3. configure: error: Please reinstall the libcurl distribution -easy.h should be in /include/curl/

    yum install curl-devel
    
  4. configure: error: libjpeg.(a|so) not found

    yum install libjpeg-devel
    
  5. configure: error: libpng.(a|so) not found.

    yum install libpng-devel
    
  6. configure: error: libXpm.(a|so) not found.

    yum install libXpm-devel
    
  7. configure: error: freetype.h not found.

    yum install freetype-devel
    
  8. configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

    yum install libc-client-devel
    
  9. configure: error: mcrypt.h not found. Please reinstall libmcrypt.

    yum install libmcrypt-devel
    
  10. configure: error: Please reinstall libmhash – I cannot find mhash.h

    yum install mhash-devel
    
  11. configure: error: Cannot find MySQL header files under /usr.Note that the MySQL client library is not bundled anymore!

    yum install mysql-devel
    
  12. configure: error: Please reinstall ming distribution. libming.(a|so) not found

  • temp remove the config for ‘–with-ming=/opt/ming/’
    configure: error: Cannot find pspell
    yum install pspell-devel
  1. configure: error: cannot find mm library

    Download from http://www.ossp.org/pkg/lib/mm/
    wget ftp://ftp.ossp.org/pkg/lib/mm/mm-1.4.2.tar.gz
    Extract it:  tar -zxvf mm-1.4.2.tar.gz
    ./configure
    make
    make install
    
  2. configure: error: Cannot find libtidy

    yum install libtidy-devel
    yum install libtidy
    change path at configure: ‘–with-tidy=/usr’
    
  3. configure: error: not found. Please reinstall the expat distribution.

    yum install expat-devel
    
  4. configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

    yum install libxslt-devel
    
  5. Tips: To uninstall, just enter:

    yum remove {package-name}
    
  6. CentOSyum安装mcrypt错误:No package php-mcrypt available.解决方法
    本文为大家讲解的是CentOSyum安装mcrypt错误:No package php-mcrypt available.解决方法,感兴趣的同学参考下。
    错误描述:

    #yum install libmcrypt libmcrypt-devel mcrypt mhash
    Setting up Install Process
    No package php-mcrypt available.
    Error: Nothing to do
    

    我们会看到centos yum从仓库中根本找不到这几个包。但我不想使用源码编译就想使用yum安装,怎么办?

解决方法:

    yum  install epel-release  //扩展包更新包
    yum  update //更新yum源
    yum install libmcrypt libmcrypt-devel mcrypt mhash  就ok了

其它方法
http://www.shayanderson.com/linux/centos-5-or-centos-6-upgrade-php-to-php-54-or-php-55.htm