Bobcares

wesupport

CLIENT AREACall Us 1-800-383-5193
Bobcares

wesupport

Call Us 1-800-383-5193
Bobcares

wesupport

Call Us 1-800-383-5193

Need help?

Our experts have had an average response time of 11.7 minutes in August 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Install PHP 8 on CentOS 7/CentOS 8 – How to do it

by | May 2, 2021

Wondering how to install PHP 8 on CentOS 7? We can help you.

PHP is the most used scripting language for web development, both websites and web applications.

As part of our Server Management Services, we assist our customers with several CentOS queries.

Today, let us see the methods our Support Techs employ to perform the installation.

 

Install PHP 8.0 on CentOS 7/CentOS 8

For our installation, we can use the REMI repository. There are two choices for the installation.

Moving ahead, let us discuss those choices in detail.

  • Install PHP 8.0 as the Default version

In order to install and have PHP 8.0 as the default version, we run the below commands.

This means replacing base packages from the distribution with ones provided by PHP 8.0.

CentOS 8:

$ sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
$ sudo dnf -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
$ sudo dnf -y install yum-utils
$ sudo dnf module reset php
$ sudo dnf module install php:remi-8.0 -y
$ sudo dnf install php -y
$ sudo dnf -y install php-{cli,fpm,mysqlnd,zip,devel,gd,mbstring,curl,xml,pear,bcmath,json}

CentOS 7:

$ sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ sudo yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
$ sudo yum -y install yum-utils
$ sudo yum-config-manager –disable ‘remi-php*’
$ sudo yum-config-manager –enable remi-php80
$ sudo yum -y install php php-{cli,fpm,mysqlnd,zip,devel,gd,mbstring,curl,xml,pear,bcmath,json}

In addition, if we need to install any additional PHP package, we run:

$ sudo yum install php-xxx

Similarly, to check the PHP version, we use:

$ php –version
PHP 8.0.0 (cli) (built: Nov 24 2020 17:04:03) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.0.0, Copyright (c), by Zend Technologies
  • Install PHP 8.0 alongside other PHP versions

CentOS 8:

$ sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
$ sudo dnf -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
$ sudo dnf -y install yum-utils
$ sudo dnf module reset php
$ sudo dnf install php80

In this stage, we need to accept installation by pressing the y key.

CentOS 7:

$ sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ sudo yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
$ sudo yum -y install yum-utils
$ sudo yum-config-manager –disable ‘remi-php*’
$ sudo yum-config-manager –enable remi-safe
$ sudo yum -y install php80

To install additional PHP extensions we use the command below:

$ sudo yum install php80-php-xxx

For example,

$ sudo yum install php80-php-{cli,fpm,mysqlnd,zip,devel,gd,mbstring,curl,xml,pear,bcmath,json}

Then we need to agree to the installation prompt.

We use the below commands to check PHP 8 version and available extensions.

$ php80 –version
PHP 8.0.0 (cli) (built: Nov 24 2020 17:04:03) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.0.0, Copyright (c), by Zend Technologies

$ php80 –modules

To upgrade to PHP 8, as the packages have the same name as in the distribution, a simple update is enough:

$ yum update

Common issue

Generally, there occurs a common issue while we proceed with the upgrade.

The upgrade may fail (by design) when some installed extensions are not yet compatible with PHP 8.0.

However, if these extensions are not mandatory, we can remove them before the upgrade.

[Need help with the installation? We can help you]

 

Conclusion

In short, PHP is the most common scripting language for web development. Today, we saw how our Support Techs go about with its installation on CentOS 7.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Tags