How to install PHP 7.3 on Ubuntu 18.04 / Linux Mint 19?

1
132

PHP is perhaps one of the most popular programming languages in the world. Most websites and internet applications are built using this programming language. Here we have told you a lot about this language, especially when we have to do some web technology. Recently, a new major version of the language was released and comes with many new features and novelties. So, that is why today I will show you how to install PHP 7.3 on Ubuntu 18.04 and Linux Mint 19.

PHP 7.3 comes with a number of new features that make you think about upgrading. Some of them refer to a more flexible heredoc and nowdoc syntax. And several performance improvements in the compiler. Keep in mind that if you are very happy with your current version of PHP, you may not want to update, but on the contrary, if you have a malfunction or want to plug a security hole, I recommend you update.

So, let us install PHP 7.3.

1. Upgrade the system

The first step, update the entire system. I always recommend you to do it for security reasons.

:~$ sudo apt update && sudo apt upgrade
1.- Upgrade the system
1.- Upgrade the system

After that, the system is ready to start installing PHP 7.3.

2. Check your current PHP version and the external repository

For the change to be noticeable, first check the version of PHP you have installed. You can do this with the following command:

:~$ php -v
2.- I have not php installed
2.- I have not PHP installed

As you can see, I do not have it installed. If as I do not have it installed, you can look for it in the official repositories and see which version you have available for now.

:~$ sudo apt search php
3.- PHP in the official repository
3.- PHP in the official repository

So, you have to add an external PPA to install PHP 7.3. However, first, you have to install these required packages.

:~$ sudo apt install software-properties-common
4.- Installing some requires packages
4.- Installing some requires packages

Then, add the PPA.

:~$ sudo add-apt-repository ppa:ondrej/php
5.- Adding the external ppa
5.- Adding the external PPA

And next, refresh the APT cache.

:~$ sudo apt update
6.- Update the cache
6.- Update the cache

Now, you can install it without any problems.

3. Install PHP 7.3 on Ubuntu 18.04 and Linux Mint

Now yes, first use APT to search for PHP packages and verify that the available version is 7.3.

:~$ sudo apt search php
7.- PHP 7.3 is available
7.- PHP 7.3 is available

Now, install PHP 7.3 and some of the most commonly used extensions:

:~$ sudo apt install php7.3 php7.3-cli php7.3-common php7.3-opcache php7.3-curl php7.3-mbstring php7.3-mysql php7.3-zip php7.3-xml
8.- Install PHP 7.3
8.- Install PHP 7.3

Next, check the version installed:

:~$ php -v
9.- PHP new version
9.- PHP new version

So, that is it.

Conclusion

It is important to update a critical element of a web server such as PHP. This is because development is very active and more and more applications require newer versions of the compiler.

Please share with your friends.

 

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here