CentOS 7 安装 PHP 7.4

CentOS 7 安装 PHP 7.4

CentOS 7官方软件仓库的PHP5.4已到使用寿命,并且不再由开发人员维护。
为了跟上新的功能和安全更新,您需要在CentOS 7系统上使用较新的(可能是最新的)PHP版本。
我们将以root用户身份运行系统,如果您不是这种情况,请使用sudo命令获取root用户权限。

CentOS 7 安装 PHP 7.4

  1. 要安装PHP 7,您需要使用以下命令在CentOS 7系统上安装并启用EPEL和Remi存储库。

    # yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    # yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
  2. 接下来,您需要安装yum-utils,它可以扩展yum的默认功能,用于管理(启用或禁用)yum存储库以及程序包,而无需进行任何手动配置。

    # yum install yum-utils
  3. yum-utils提供的程序之一是yum-config-manager,您可以使用它来启用Remi存储库作为默认存储库,以安装不同的PHP版本。

    # yum-config-manager --enable remi-php70   [Install PHP 7.0]

    如果您想在CentOS 7上安装PHP7.1,PHP7.2,PHP7.3或PHP7.4,则如下所示启用它。

    # yum-config-manager --enable remi-php71   [Install PHP 7.1]
    # yum-config-manager --enable remi-php72   [Install PHP 7.2]
    # yum-config-manager --enable remi-php73   [Install PHP 7.3]
    # yum-config-manager --enable remi-php74   [Install PHP 7.4]
  4. 现在,使用以下命令安装PHP7和所有必需的模块。

    # yum install php php-cli php-common php-gd php-json php-ldap php-mbstring php-mysqlnd php-pdo php-xml

    然后,检查系统上PHP的安装版本。

    # php -v
    PHP 7.4.2 (cli) (built: Jan 21 2020 11:35:20) ( NTS )
    Copyright (c) The PHP Group
    Zend Engine v3.4.0, Copyright (c) Zend Technologies
0 0 投票数
喜欢就给个好评吧!
赞(0) 打赏
未经允许不得转载:爱易默博客 » CentOS 7 安装 PHP 7.4
订阅评论
提醒
guest

0 评论
内联反馈
查看所有评论
免责声明:本站大部分下载资源收集于网络,只做学习和交流使用,版权归原作者所有,请在下载后24小时之内自觉删除,若作商业用途,请购买正版,由于未及时购买和付费发生的侵权行为,与本站无关。本站发布的内容若侵犯到您的权益,请联系站长删除,我们将及时处理! Disclaimer: Most of the download resources on this site are collected on the Internet, and are only used for learning and communication. The copyright belongs to the original author. Please consciously delete within 24 hours after downloading. If you use it for commercial purposes, please purchase the original version. If the content posted on this site violates your rights, please contact us to delete it, and we will deal with it in time!

联系我们 Contact us

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

0
希望看到您的想法,请您发表评论x