Run the following command to get the version of PHP installed on Ubuntu machine:
lsb_release -a
The output should look like this:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
In the above result 20.04 is the version of Ubuntu installed on our EC2 instance.