4

My question applies to Debian/Ubuntu:

Prior to updating/upgrading my Linux environment I want to implement best-practice procedures by taking a snapshot of my components' versions through a simple script that records into a text file version numbers for OS, mySQL, PHP and so on.

However I can't find anywhere how to reliably obtain version number for phpMyAdmin via command line.

If there is no better way I'm happy to grep files such as

/usr/share/phpmyadmin/Config.php or /usr/share/phpmyadmin/package.json .

Am I missing something?

I know how to check version number via phpMyAdmin's web interface but that is not helpful for what I need.

Dave White
  • 230
  • 1
  • 2
  • 9

2 Answers2

8

If you’re also following the best practice of using packages,

dpkg -l phpmyadmin

will tell you which version of the phpmyadmin package is installed (assuming it is installed).

If you only want the version,

dpkg-query -W -f '${version}\n' phpmyadmin

will only output the version of phpmyadmin.

If you’re not using a packaged version, but you know where the package.json file lives,

jq .version /path/to/package.json

will give you the version.

If you want to query the version from the web server, you need to look for PMA_VERSION in the home page:

curl -s https://example.org/phpmyadmin | grep -E -o 'PMA_VERSION:"[[:digit:].]+"'
Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
  • Stephen, I should have probably mentioned that one of the systems I have is a bare-bones GUI-less Debian installation, so packages such as `jq` are not available. However from the gist of your updated answer sounds like grepping the `package.json` is close enough to the `jq` method, which is good enough for me. Thanks again. – Dave White Jan 26 '21 at 15:13
2

Using grep-status from dctrl-tools tool:

grep-status -sPackage,Version -PX 'phpmyadmin'

sample output:

Package: phpmyadmin
Version: 4:4.9.5+dfsg1-2

grep-status manpages

GAD3R
  • 63,407
  • 31
  • 131
  • 192