GoAdmio Command Line: removephp with /go/removephp

/go/removephp removes one installed PHP version from the server, the opposite of installphp. It: It works on AlmaLinux, Rocky, CentOS, Red Hat, Fedora, Debian, and Ubuntu. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# Remove PHP 8.2
/go/removephp 8.2

Options

Argument Required Default Notes
<version> Yes — One digit, a dot, and one digit, for example 8.3.
--force No — Allows removing PHP 8.5. It is the only check it skips.
--progress No — Reports completion for GoAdmio’s progress display.

Both flags are detected anywhere in the arguments, after the version.

Examples

# Remove PHP 8.2
/go/removephp 8.2

# Remove PHP 8.5, which is normally protected
/go/removephp 8.5 --force

# Check that it's gone
rpm -qa | grep php81 # AlmaLinux, Rocky, CentOS, Red Hat, Fedora
dpkg -l | grep php8.1 # Debian, Ubuntu

Before removing a version, move every account that uses it to another version with multiphp. That page also shows how to list the installed PHP versions.

Output

Outcome What you get
No version given Usage: removephp <Version> and exit status 1.
Version in the wrong format Invalid PHP Version and exit status 1.
PHP 8.5 without --force PHP 8.5 Required and exit status 1.
Another install or removal is running Instance (<name>) already running. and exit status 1.
Removal ran The output of dnf or apt, plus step names such as Removing PHP 8.3 FPM.
Removal ran with --progress The last step reports Removing PHP <version> completed successfully, then 100 is printed.

Notes on the output:

  • Many No match for argument or Unable to locate package messages are normal. The command tries a long list of extensions, and not every PHP version has all of them.
  • The exit status is 0 after the removal starts, even if packages could not be removed. Check the result yourself (see Examples).
  • Every run is logged with a timestamp and its arguments to /var/log/go/removephp.log.

See the full reference at /go/removephp and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *