Here are some ways that you can check the installed version of PHP in your system;

  1. Run php -v from the command line.

    $ php -v
    PHP 7.0.19 (cli) (built: Jun 21 2017 07:13:57) ( NTS )
    Copyright (c) 1997-2017 The PHP Group
    Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
  2. Run php -i from the command line.

    $ php -i | grep "PHP Version"
    PHP Version => 7.0.19
    PHP Version => 7.0.19
  3. Print PHP_VERSION_ID from PHP script.

    echo PHP_VERSION_ID;
    //Sample output: 70019
  4. Print phpversion() output from PHP script.

    echo phpversion();
    //Sample output: 7.0.19
  5. View from phpinfo() output


  6. Query your package manager where the PHP packages are installed from. Here’s a list of some common package managers and the corresponding commands;
Platform Location
homebrew brew list –versions php