Centos6.8安裝php5.6

  1. 檢查當前安裝的PHP包
    yum list installed | grep php
    若是有安裝的PHP包,先刪除他們, 如:
    yum remove php.x86_64 php-cli.x86_64 php-common.x86_64
  2. 配置安裝包源:
    # 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  [上面搜索到的包便可]
  3. 執行安裝
    yum -y install php56w.x86_64
    yum -y --enablerepo=webtatic install php56w-devel
    yum -y install php56w-pdo php56w-xml php56w-gd php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64 php56w-opcache.x86_64
  4. 安裝PHP FPM
    yum -y install php56w-fpm
    #設置php-fpm開機啓動
    chkconfig php-fpm on
    #啓動php-fpm
    /etc/init.d/php-fpm start
    注:若是想更換到php5.5或5.4版本, 直接把上面的56w換成55w或者54w就能夠了
相關文章
相關標籤/搜索