How to check PHP version on Ubuntu

  1. We’ll start off with the quickest method. Open a command line terminal and type the following command.
    $ php -version
    PHP 7.4.3 (cli) (built: May 26 2020 12:24:22) ( NTS )
    Copyright (c) The PHP Group
    Zend Engine v3.4.0, Copyright (c) Zend Technologies
        with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
    
  2. What if we want a little more in depth information? You can start a PHP interactive shell (again, from the command line) and use the phpinfo function. This will return a ton of information, but will show the PHP version at the top.
    $ php -a
    Interactive mode enabled
    
    php > phpinfo();
    phpinfo()
    PHP Version => 7.4.3
    ...
    
    php > exit
    
  3. Lastly, we could use the phpinfo function again, but inside of a php file. The perk of this method is that all the information will be formatted nicely for us and viewable inside a browser. We have a full guide on how to create a phpinfo.php page, but it basically just involves saving a PHP file with the following line of code and then accessing it from your browser.
    <?php phpinfo(); ?>
  • 521 Users Found This Useful
Was this answer helpful?

Related Articles

Advantages of ZFS

ZFS as a rather new filesystem offers various advantages in comparison to regular filesystems...

Analysing log files in Windows and Linux

Everyone knows the scenario, you want to analyze an issue of your server or local computer but...

Can i use TUN/TAP ?

Yes our VPS are KVM or Vmware based and you have your own kernel so using TUN/TAP is no problem.

Changing the Windows Administrator password – The easy way

Today we are going to show you how to change your Windows Administrator password the easy...

Command ‘curl’ not found on Ubuntu 20.04

The following error message may appear on your terminal hinting the unavailability of the curl...