Baeldung Pro – Linux – NPI EA (cat = Baeldung on Linux)
announcement - icon

Learn through the super-clean Baeldung Pro experience:

>> Membership and Baeldung Pro.

No ads, dark-mode and 6 months free of IntelliJ Idea Ultimate to start with.

Partner – Orkes – NPI EA (tag=Kubernetes)
announcement - icon

Modern software architecture is often broken. Slow delivery leads to missed opportunities, innovation is stalled due to architectural complexities, and engineering resources are exceedingly expensive.

Orkes is the leading workflow orchestration platform built to enable teams to transform the way they develop, connect, and deploy applications, microservices, AI agents, and more.

With Orkes Conductor managed through Orkes Cloud, developers can focus on building mission critical applications without worrying about infrastructure maintenance to meet goals and, simply put, taking new products live faster and reducing total cost of ownership.

Try a 14-Day Free Trial of Orkes Conductor today.

1. Overview

phpMyAdmin is a popular web-based tool for managing MySQL and MariaDB databases. Although it’s commonly accessed through a browser, there are times when we need to check the version of phpMyAdmin directly from the command line, especially on Linux servers. Moreover, knowing the exact version can be crucial for troubleshooting, updating, or ensuring compatibility with other software.

In this tutorial, we’ll discuss the possible approaches to obtain the phpMyAdmin version through the Linux command line. This will involve package manager tools like dpkg, apt, aptitude, and internal version files such as README, ChangeLog, and composer.json.

2. Using Package Managers

In Linux, package managers provide a centralized way to install, update, and manage software packages. Additionally, they offer tools to query installed packages, which we can use to check the phpMyAdmin version. Notably, the approaches discussed in this section are applicable if the phpMyAdmin was installed via a package manager.

2.1. dpkg

The dpkg (Debian package) is the foundation of the package management system in Debian and its derivatives like Ubuntu. Furthermore, the dpkg command with the -l option displays a list of all installed packages and their version details. Specifically, to check the phpMyAdmin version, we can use the command dpkg -l and package name phpMyAdmin.

Let’s go ahead and enter this command in the shell:

$ dpkg -l phpmyadmin
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Tr>
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version                Architecture Description
+++-==============-======================-============-================>
ii  phpmyadmin     4:5.1.1+dfsg1-5ubuntu1 all          MySQL web admini>

In this output, we can see phpMyAdmin package information, showing its version, which is 4:5.1.1+dfsg1-5ubuntu1.

2.2. Understanding the phpMyAdmin Version Number

Here’s a detailed explanation of each part of version number 4:5.1.1+dfsg1-5ubuntu1:

  • The 4: at the beginning is the epoch that handles the changes in version schemes
  • The 5.1.1 is the upstream version of phpMyAdmin released by developers
  • The +dfsg1 indicates the Debian modification for compliance with free software guidelines
  • Lastly, the -5ubuntu1 shows the first (1) Ubuntu-specific revision of the fifth (5) Debian package

2.3. apt

The apt provides a high-level command line interface for the package management systems providing a more user-friendly interface than the dpkg. Furthermore, when used with the show subcommand, it shows detailed information about the given package, including its version, dependencies, installation and downloadable size, and much more.

For instance, let’s try obtaining the phpMyAdmin package information in the shell:

$ apt show phpmyadmin
Package: phpmyadmin
Version: 4:5.1.1+dfsg1-5ubuntu1
Priority: optional
Section: universe/web
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: phpMyAdmin Packaging Team <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 36.5 MB

Here, we can see the various information about the phpMyAdmin package displaying its version details which is 4:5.1.1+dfsg1-5ubuntu1.

2.4. aptitude

The aptitude is the more advanced package manager that combines the functionalities of both dpkg and apt. Like apt and dpkg, we can use the show subcommand or the -l option with the aptitude command to display the phpMyAdmin package information.

For now, let’s use the aptitude with the show subcommand:

$ aptitude show phpmyadmin
Package: phpmyadmin
Version: 4:5.1.1+dfsg1-5ubuntu1
State: installed
Automatically installed: no
Priority: optional
Section: universe/web
Maintainer: Ubuntu Developers <[email protected]>
Architecture: all
Uncompressed Size: 36.5 M

We can see the output similar to the apt show command, listing the version number for phpMyAdmin as 4:5.1.1+dfsg1-5ubuntu1.

3. Using Internal Version Files

In addition to the packet managers, we can also check the phpMyAdmin version by looking at certain internal files within the phpMyAdmin installation directory. These files often contain version information and can be accessed via the command line.

This approach is particularly useful for systems where the phpMyAdmin was installed manually or where a package manager isn’t available. Moreover, the phpMyAdmin directory path may vary based on the Linux distribution, but we can always find the phpMyAdmin directory path by running the whereis phpmyadmin command. However, on Ubuntu or Debian, it’s typically located at /usr/share/phpmyadmin/.

3.1. README File

Usually, the README file contains important information about the software, including its version details at the top. To check the phpMyAdmin version, we can use the head command to display the first few lines of this file.

Let’s try executing the head command in the shell:

$ head -4 /usr/share/phpmyadmin/README
phpMyAdmin - Readme
===================
Version 5.2.1

In return, we can see the phpMyAdmin version, which is 5.2.1.

3.2. ChangeLog File

The ChangeLog file keeps a record of the changes made to the software over time, usually listing updates, bug fixes, and version changes. To see the phpMyAdmin version, we can use the head or cat command to view the beginning of this file.

For instance, let’s use the head command:

$ head -5 /usr/share/phpmyadmin/ChangeLog
phpMyAdmin - ChangeLog
======================
5.2.1 (2023-02-07)
- issue #17522 Fix case where the routes cache file is invalid

In the above output, 5.2.1 (2023-02-07) indicates the version and release date of the phpMyAdmin.

3.3. composer.json File

The composer.json is a part of the composer dependency management system and often contains metadata about the project including its version. To find the version of the phpMyAdmin, we can search for a version line in this file.

For example, let’s use the cat command to display the content of the composer.json file and pipe it to the grep to filter and display only version information:

$ cat /usr/share/phpmyadmin/composer.json | grep version
            "composer/package-versions-deprecated": true
    "version": "5.2.1"

Consequently, the output shows that the version of the phpMyAdmin in the composer.json file is 5.2.1.

4. Conclusion

In this article, we’ve explored different approaches to obtain the phpMyAdmin version using the Linux command line, including package manager tools and internal version files. For package managers, we examined tools such as dpkg, apt, and aptitude to retrieve phpMyAdmin version information. Meanwhile, for internal version files, we looked at methods involving README, ChangeLog, and composer.json files that can provide the necessary version information.