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.

2 Answers 2

9

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:].]+"'
1
  • 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
    Commented Jan 26, 2021 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .