Being a popular server-side scripting language, PHP is used in the creation of dynamic websites, content management systems, and many famous frameworks such as Laravel, WordPress, etc which are developed in PHP. As of preparing this post, the latest stable release of PHP is 8.2.
Installing PHP 8 on Linux Mint 20
PHP 8 is not included in the Linux Mint 20 standard repositories. However, it can be installed on Linux Mint 20 from the Ondřej Surý PPA repository.
Complete the below-given steps to install PHP 8 on Linux Mint 20:
Step 1: Update apt cache
Fire up the terminal and update the apt repository cache with the command:
Step 2: Install dependencies
Next, install the required dependencies for PHP 8:
The required dependencies are installed successfully.
Step 3: Add Ondřej PPA repository
Now, add the Ondřej Surý PPA repository with the command:
Once the Ondřej Surý PPA repository is successfully added, update the apt repository cache again with the command:
Step 4: Install PHP 8 on Linux Mint 20
Install PHP 8 on Linux Mint 20 with the command:
The PHP 8 will be installed on Linux Mint 20.
Type the below-given command if you want to get PHP 8 as Apache Module:
Press ‘y’ to continue installing PHP 8 on Linux Mint 20.
Both above-mentioned commands will install PHP 8 on Linux Mint 20
Once the PHP 8 is successfully installed, check the installed version and verify the installation with the command:
The PHP 8.0.2 is installed on Linux Mint 20.
If you have installed PHP as an apache module, restart the apache server when the PHP is installed:
Installing the PHP extensions on Linux Mint 20
The PHP extension enhances the functionality of PHP. Extensions are the PHP libraries and can be installed on Linux Mint 20 using the apt command as follows:
Have a look at the available PHP extensions with the command:
Let’s install the PHP MySQL extension with the command:
The MySQL extension will be installed successfully.
Remove PHP 8 from Linux Mint 20
At any point, if you wish to remove PHP 8 from Linux Mint, run the below-given command to do so:
Press ‘y’ to continue removing PHP 8.
Conclusion
A lot of programmers use PHP for creating websites. Installing PHP 8 on Linux Mint 20 is easy and straightforward. PHP 8 is available from the Ondřej Surý repository. This article explains PHP 8 installation on Linux Mint 20.