GoAdmio

listphp

List the PHP versions available to install from the server's package repositories

On this page: Overview · Quick start · Syntax · Output · Examples · Troubleshooting · Details · See also


Overview

/go/listphp asks the server's package manager which PHP versions it can provide and prints them, oldest first, one per line. It:

It reads the repositories, not the server. The list shows versions you can install, which includes versions that are already installed. To see which versions are actually in use, check multiphp or defaultphp.

The command changes nothing on the server.


Quick start

# Show every PHP version the server can provide
/go/listphp

Syntax

/go/listphp

The command takes no options. Any arguments you pass are written to the log but otherwise ignored.

Supported operating system Package manager used
AlmaLinux, Rocky, CentOS, Red Hat, Fedora dnf search php
Debian, Ubuntu apt-cache search php

On any other operating system the command prints nothing.


Output

One version number per line, in ascending order, with no header or footer.

7.4
8.0
8.1
8.2
8.3
8.4
8.5
Outcome What you get
Versions found One <major>.<minor> version per line.
No supported version found Empty output.
Unsupported operating system Empty output.

The exit status is 0 in every case, including empty output, so a script cannot tell "none found" from success by the exit code. Check whether the output is empty instead.


Examples

# Check whether a specific version is available (prints yes or no)
/go/listphp | grep -qx 8.4 && echo yes || echo no
# Get the newest available version
/go/listphp | tail -n 1
# Count the available versions
/go/listphp | wc -l
# Review recent calls to the command
tail -n 5 /var/log/go/listphp.log

Troubleshooting

Symptom Likely cause Fix
No output at all Unsupported operating system, or the repository search returned nothing (no network or no working repository). Check the OS with cat /usr/local/goadmio/linux/os.db, then check that dnf search php or apt-cache search php works.
A version you expect is missing The server's repositories don't carry it. Default distribution repositories often include only a few PHP versions. Add the repository that provides that version, then run the command again.
Version 8.6 never appears It is deliberately hidden as a beta release. Wait until it is enabled in the script.
A very new version never appears The command only knows versions up to 10.0, and each one is listed by name. Update the script's version list.
Debian/Ubuntu list looks out of date apt-cache reads the local package cache, which is only refreshed by apt update. Run apt update, then run the command again.
First run is slow on AlmaLinux, Rocky, CentOS, Red Hat, or Fedora dnf may refresh its repository metadata before searching. Wait. Later runs are faster.
A listed version isn't installed By design. The list shows what is available, not what is installed. Install it with installphp.

Details

How it works

flowchart TD
    A["listphp"] --> B["Log the call"]
    B --> C["Read the OS name"]
    C --> D{"Which OS family?"}
    D -- "AlmaLinux, Rocky, CentOS, Red Hat, Fedora" --> E["dnf search php"]
    D -- "Debian, Ubuntu" --> F["apt-cache search php"]
    D -- "Anything else" --> G["Nothing found, empty output"]
    E --> H["Match each supported version, 5.6 to 10.0"]
    F --> H
    H --> I["Print the matches, oldest first"]

What it matches

Operating system What is extracted from the search results
AlmaLinux, Rocky, CentOS, Red Hat, Fedora Text such as PHP 8.3 in package descriptions.
Debian, Ubuntu Package names that start with php followed by a version, such as php8.3.

The extracted results are then compared with a fixed list of versions: 5.6, 7.0 to 7.4, 8.0 to 8.5, 8.7 to 8.9, 9.0 to 9.9, and 10.0. A version is printed if its number appears anywhere in the results.

Limitations

Log file

Each call appends a line to /var/log/go/listphp.log, in the form [Nov 19 12:00:00]# listphp. Writing the log uses sudo.


See also

Command Description
installphp Install a different PHP version on GoAdmio
removephp Remove a PHP version from a GoAdmio server
defaultphp Change the default PHP version in the CLI
multiphp Manage PHP versions per domain
extension List, install, or remove PHP extensions across every version
create Create a GoAdmio account from the command line (--phpversion)