Every application developer must use recent versions of the language. This is because it allows him to take advantage of all the potential of language and above all for security reasons. However, distributions such as CentOS 8 do not provide the latest stable versions of programs because it uses freezing phases of the software that is then tested and when there are no serious failures is considered stable. This brings a great advantage that is stability but also brings a disadvantage that is the absence of the most recent packages. However, the community always finds a way to solve the problem through stable and secure third-party repositories. Well, in the case of PHP it happens similarly. CentOS 8 comes with PHP 7.2 in its repositories, but PHP 7.3 already exists. In this post, you will learn how to install PHP 7.3 on CentOS 8.
PHP is very known. This web-oriented language is widely known for its ease of learning and its power. Fortunately, PHP development is quite active and from time to time we have a new version that helps to improve the stability and security of the applications made with the language. Then, it is convenient to develop with recent versions of the language. Or in the case of servers, it is convenient to have updated libraries and languages so that new applications can run correctly.
Well, let’s get started.
Install PHP 7.3 on CentOS 8
First of all, I always recommend updating the operating system completely, before performing any operation on it.
Open a terminal and run:
:~$ su
:~# dnf update
Now you will have a more secure system thanks to the security patches installed during the upgrade.
PHP 7.3 is available thanks to the REMI repository. The problem is that this repository depends on the EPEL repository. This repository must be enabled.
To enable the EPEL repository, just execute the following command:
:~$ rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Once the corresponding package is installed, the EPEL repository will be activated. It’s that simple.
Then, we can enable the REMI repository which is where PHP 7.3 is. To do this, just use this command:
:~$ dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
REMI is a fantastic repository because it has several versions of PHP available. In this case, we are interested in version 7.3. To enable this “section” of the repository, use the following command:
:~$ dnf module enable php:remi-7.3
Now, you can install PHP 7.3 with the following command:
:~$ dnf install php php-cli php-common
This command will install the most basic language as the interpreter. Remember that if you are going to develop or serve applications you have to install the necessary PHP modules.
Finally, you can verify the installed version with the following command:
:~$ php -v
And ready, you can continue installing the PHP modules you need. And start working.
Conclusion
Installing PHP is not complicated in almost any current Linux distribution, however, it is convenient to have recent versions that help improve the fluidity of the system. For this, we use an external repository to provide the packages that by default the distribution does not give us. Today you have learned to install PHP 7.3 in CentOS in a fast and simple way.
Please share this post with your friends through social networks. We also ask you to join our Telegram channel.
:~$ rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
should now be changed to
dnf install epel-release
as it is outdated (8-7.el8 vs 8-8.el8) and plain available via default repos.