How to Check PHP Version on Linux?


PHP also known as “Hypertext Preprocessor” is a scripting language that was designed for web development. It is a very powerful yet fast and flexible programming language that enables you to create extremely interactive web interfaces. Moreover, it can work well with almost any famous operating system. In this guide, we intend to talk about the different methods of checking the version of PHP installed on a Linux Mint 21 system.

For more detail and the latest information about the PHP version available, please check out this site.

Different Methods of Checking the PHP Version on Linux Mint 21:

There are multiple ways of finding out the version of PHP installed on your Linux Mint 21 system. These methods are discussed below:

Method # 1: Using the “version” Command:

This method makes use of the “version” command to display the PHP version on the terminal in the following manner:

$ php --version

The version of PHP installed on our Linux Mint 21 system is shown in the image below:

Check-PHP-Version-Linux

Method # 2: Using the “-v” Flag:

Now, we will be using the “-v” flag to check the PHP version on our Linux Mint 21 system as follows:

$ php –v

Check-PHP-Version-Linux

The image shown below presents the version of PHP installed on our Linux Mint 21 system:

Check-PHP-Version-Linux

Method # 3: Using the “apt list” Command:

Finally, we will be using the “apt list” command to find out the version of PHP installed on our system. In this regard, we will be using this command with the “installed” option which is used to list down all the installed packages. However, since we only want to fetch the information regarding the installed PHP package, therefore, we have paired it up with the “grep” command to extract the relevant information only as follows:

$ apt list --installed | grep php

You can see the version of PHP installed on our Linux Mint 21 system by taking a look at the output shown in the image below:

Check-PHP-Version-Linux

Conclusion:

This article discussed the three different yet easy methods of checking the PHP version installed on a Linux Mint 21 system. Now, you can follow any of these methods to quickly figure out what version of PHP you are currently running on your system.

If you are interested in knowing the Ubuntu version, click here.

Print Friendly, PDF & Email
Categories