Upgrade php 7.4 centos 7

As we know that PHP is the most important part of LAMP applications [WordPress, Joomla, Drupal & Media wiki etc]. Now a days most of these applications require PHP 7 for their installation and configuration. Main advantage of PHP 7.x is that it will load your web application faster and will consume less server’s resources like CPU and RAM.

By default, PHP 5.4 is available in CentOS 7 and RHEL 7 yum repositories.  In this article we will demonstrate how to install latest version of PHP on CentOS 7 and RHEL 7 Servers.

Installation Steps of PHP 7.1, 7.2, 7.3 and 7.4 on CentOS 7 Server

1] Install yum-utils and enable EPEL repository

Login to your server and use the below yum command to install yum-utils & enable epel repository

[[email protected] ~]# yum install epel-release yum-utils -y

2] Download and Install remirepo using yum command

[[email protected] ~]# yum install //rpms.remirepo.net/enterprise/remi-release-7.rpm

3]  Based on your requirement, configure the PHP 7.x repository

To configure PHP 7.1 repository, use below command,

[[email protected] ~]# yum-config-manager --enable remi-php71

To configure PHP 7.2 repository, use below command,

[[email protected] ~]# yum-config-manager --enable remi-php72

To configure PHP 7.3 repository, use below command

[[email protected] ~]# yum-config-manager --enable remi-php73

To configure PHP 7.4 repository, use below command

[[email protected] ~]# yum-config-manager --enable remi-php74

4] Install PHP 7.4 along with dependencies.

In this tutorial, I will install latest version of PHP 7.4 along with its modules, Run beneath yum command

[[email protected] ~]# yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysql -y

Note: To search all PHP modules use  below command:

[[email protected] ~]# yum search php | more

5] Verify the PHP version

Once PHP and its dependencies are installed in step4], use below command to verify the installed PHP version,

[[email protected] ~]# php -v
PHP 7.4.4 [cli] [built: Mar 17 2020 10:40:21] [ NTS ]
Copyright [c] The PHP Group
Zend Engine v3.4.0, Copyright [c] Zend Technologies
    with Zend OPcache v7.4.4, Copyright [c], by Zend Technologies
[[email protected] ~]#

Installation Steps of PHP 7.x on RHEL 7 Server

1] Enable EPEL, RHEL 7 Server Optional repository and Install remirepo rpm

Login to your RHEL 7 Server and run the beneath commands one after the another to enable EPEL repository, install remirepo and enable RHEL 7 Server optional repository

[[email protected] ~]# rpm -Uvh //dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[[email protected] ~]# wget //rpms.remirepo.net/enterprise/remi-release-7.rpm
[[email protected] ~]# rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
[[email protected] ~]# subscription-manager repos --enable=rhel-7-server-optional-rpms

2] Configure PHP 7.x repo

[[email protected] ~]# yum install yum-utils
[[email protected] ~]# yum-config-manager --enable remi-php74

3] Install PHP 7.4 and its dependencies

[[email protected] ~]# yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysql -y

4] Verify PHP Version

[[email protected] ~]# php -v

PHP 7 Test Page Verification

I am assuming Apache web Server is installed on your system, start its service using below systemctl command

[[email protected] ~]# systemctl start httpd
[[email protected] ~]#

Now create a info.php file under /var/www/html with following contents,

[[email protected] ~]# cd /var/www/html/
[[email protected] html]# vi info.php

Open the web browser and type the ip of your server followed by info.php,

//Server-IP-Address/info.php

This confirms that you have successfully installed PHP 7.4 on your system. That’s all from this article, please do share your feedback and comments.

Also Read: How to Install PHP 7.4 on CentOS 8 / RHEL 8

How upgrade PHP 5.4 to PHP 7.4 on CentOS 7?

Upgrade to PHP 7.
sudo yum install //centos7.iuscommunity.org/ius-release.rpm. ... .
sudo yum remove php-common mod_php php-cli. ... .
sudo yum update. ... .
sudo yum install php70u php70u-pdo php70u-mysqlnd php70u-opcache php70u-xml php70u-gd php70u-devel php70u-mysql. ... .
sudo systemctl restart httpd..

How upgrade PHP 5.4 to PHP 5.6 on CentOS 7?

upgrading php 5.4 to 5.6 on CentOS 7.
After installing Webtatic yum repository, you need to remove the old version of php-common package. ... .
Now we install PHP 5.6 using following command: # yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring..

How do I update PHP to latest version?

Log in to your one.com control panel. Scroll down to the Advanced settings tile and select PHP and database settings. Scroll down to Update PHP version. Select the PHP version you want to switch to and click Update.

Can I upgrade to PHP 8?

Upgrading from PHP 7. x to PHP 8 involves not only upgrading PHP core, but all of its extensions. For example, if you use the PHP extension cURL, you will need to manually install the PHP 8 version at the end of this guide.

Bài mới nhất

Chủ Đề