How to Install PHP 7.4 in CentOS 7

The CentOS 7 official software repositories have PHP 5.4 which has reached the end of life and no longer actively maintained by the developers.

To keep up with the latest features and security updates, you need a newer (probably the latest) version of PHP on your CentOS 7 system.

For the purpose of this guide, we will be operating the system as root, if that is not the case for you, make use of the sudo command to acquire root privileges.

Installing PHP 7 on CentOS 7

  1. To install PHP 7, you have to install and enable EPEL and Remi repository on your CentOS 7 system with the commands below.

    # 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. Next, you need to install yum-utils, a collection of useful programs for managing yum repositories and packages. It has tools that basically extend yum’s default features.
    It can be used for managing (enabling or disabling) yum repositories as well as packages without any manual configuration and so much more.

    # yum install yum-utils
  3. One of the programs provided by yum-utils is yum-config-manager, which you can use to enable Remi repository as the default repository for installing different PHP versions as shown.

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

    If you want to install PHP 7.1, PHP 7.2 PHP 7.3 or PHP 7.4 on CentOS 7, just enable it as shown.

    # 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. Now install PHP 7 with all necessary modules with the command below.

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

    Afterwards, double check the installed version of PHP on your system.

    # 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 votes
Article Rating
赞(0) 打赏
未经允许不得转载:iemblog » How to Install PHP 7.4 in CentOS 7
Subscribe
Notify of
guest

0 COMMENTS
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
免责声明:本站大部分下载资源收集于网络,只做学习和交流使用,版权归原作者所有,请在下载后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
Would love your thoughts, please comment.x
()
x