how to update php in centos,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 7To 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

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

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]

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 vote

Article Rating

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值