centOS安裝php最新版本

來源:互聯網
上載者:User

查看 centos 版本:

[root@iZ23d ~]# cat /etc/centos-release  
CentOS Linux release 7.2.1511 (Core)
 

 

1、刪除之前的 php 版本:   

 

  [root@iZ23d ~]#  yum remove php* php-common     Loaded plugins: langpacks Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration No Match for argument: php-5.4.16 No Match for argument: php-5.4.16.tar.gz No Match for argument: php-7.0.1RC1 No Match for argument: php-7.0.1RC1.tar.gz No Match for argument: phpMyAdmin-4.4.0.tar.gz No Match for argument: php-common No Packages marked for removal   

 

    2、 rpm 安裝 Php7 相應的 yum源:      [root@iZ23d ~]#  rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm      Retrieving https://mirror.webtatic.com/yum/el7/webtatic-release.rpm warning: /var/tmp/rpm-tmp.LhJKKR: Header V4 RSA/SHA1 Signature, key ID 62e74ca5: NOKEY Preparing...                          ################################# [100%]         package webtatic-release-7-3.noarch is already installed  
3、  直接yum安裝php7:   [root@iZ23d ~]#  yum install php70w     Loaded plugins: langpacks Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Resolving Dependencies --> Running transaction check 。。。  【省略】 Warning: RPMDB altered outside of yum.   Installing : php70w-common-7.0.0-1.w7.x86_64                              1/3   Installing : php70w-cli-7.0.0-1.w7.x86_64                                 2/3   Installing : php70w-7.0.0-1.w7.x86_64                                     3/3   Verifying  : php70w-7.0.0-1.w7.x86_64                                     1/3   Verifying  : php70w-common-7.0.0-1.w7.x86_64                              2/3   Verifying  : php70w-cli-7.0.0-1.w7.x86_64                                 3/3   Installed:    php70w.x86_64 0:7.0.0-1.w7   Dependency Installed:    php70w-cli.x86_64 0:7.0.0-1.w7        php70w-common.x86_64 0:7.0.0-1.w7   Complete!  

4、 檢查 php 版本: [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 [root@iZ23d2e6hoqZ ~]#   以上顯示安裝成功。   5、重啟 Apache,查看 phpinfo :   [root@iZ23d ~]# systemctl restart httpd.service

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.