GoAdmio

installphp

Install a PHP version with its extensions and PHP-FPM service on a GoAdmio server

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


Overview

/go/installphp installs one PHP version next to the versions already on the server. It:

The command installs a version only. It does not change which version any domain uses. Use multiphp for that.


Quick start

/go/installphp 8.3

Requirements


Syntax

/go/installphp <version> [--progress]
Form Behavior
/go/installphp <version> Installs the version and prints the package manager's output.
/go/installphp <version> --progress Same, and also prints progress messages for the panel, ending with 100.

The --install flag is used internally when GoAdmio itself is installed. It skips the default php.ini and session steps, because the installer runs them once at the end. Don't use it yourself.

[!WARNING] On Debian and Ubuntu, installing a version that is already installed purges it first, including its configuration, and sites using it can fail until the reinstall finishes. See Details.


Arguments

Argument Required Default Notes
<version> Yes — One digit, a dot, one digit, such as 7.4 or 8.3. Anything else is rejected with Invalid PHP Version.
--progress No Off Prints progress messages.

Output

Outcome What you get
No argument Usage: removephp <Version> and exit code 1. The message names the wrong command.
Invalid version Invalid PHP Version and exit code 1.
Another install running Instance (<name>) already running. and exit code 1.
Installing The output of dnf or apt.
Installing with --progress A message for each extension, such as Installing PHP 8.3 GD, then Installing PHP 8.3 completed successfully and 100.

The command exits with 0 even if some packages failed to install, because it doesn't check the result of the package manager.

Logging

Every run is appended to /var/log/go/installphp.log.

Locking

The lock file /usr/local/goadmio/lock/installphp.lock blocks a second run. A lock older than 10 minutes is treated as stale and replaced.


Examples

# Install PHP 8.3
/go/installphp 8.3
# Install with progress messages
/go/installphp 8.3 --progress
# Confirm it is installed
/go/multiphp return
# Use it for one domain
/go/multiphp example.com 8.3

Troubleshooting

Symptom Likely cause Fix
Usage: removephp <Version> No version was given. The message names the wrong command. Pass a version, such as 8.3.
Invalid PHP Version The version isn't in X.Y form with single digits. Use a value like 8.3.
Instance (...) already running. Another install is running, or one ended less than 10 minutes ago. Wait and try again.
No match for argument or Unable to locate package for some extensions The extension is built into that PHP version, was removed from it, or isn't packaged. Usually harmless. Check that the core packages (php, fpm) installed.
The core packages fail to install The repository that provides this version isn't set up. Add the repository, then run the command again.
The version is not listed by multiphp return Its php.ini or PHP-FPM package is missing. Read the package manager's output and install the missing package.
A reinstalled version lost its settings (Debian and Ubuntu) The existing packages were purged. Run /go/phpini to apply the default values again.
Sites broke while reinstalling a version (Debian and Ubuntu) The version was purged and reinstalled. Wait for the install to finish, or run it in a quiet period.
The install takes a long time One package-manager call is made per extension. Wait. Run it in a quiet period.
Apache-related errors on a server that uses Nginx The Apache module and a2enconf steps run even when Nginx is active. See Notes for maintainers.

Details

What it does

  1. Logs the call and reads the operating system name from /go/function.
  2. Takes the lock /usr/local/goadmio/lock/installphp.lock.
  3. Stops if no version was given, or if the version isn't in X.Y form.
  4. Installs PHP, PHP-FPM, and the extensions (see below).
  5. Moves the version's PHP-FPM pool to its own port, 90 plus the version digits.
  6. Creates /run/sock/<digits> (mode 777) for PHP-FPM sockets. On RPM systems it also creates the version's session and WSDL-cache folders under /var/lib/php<digits>, with mode 777.
  7. Without --install: runs /go/phpini, session, web, and /go/fpm enable. With --install: runs only web and fpm enable.
  8. Removes /usr/local/goadmio/tmp/lock.db.
  9. With --progress: prints the completion message and 100.
  10. Removes the lock.

AlmaLinux, Rocky, CentOS, Red Hat, and Fedora

apcu, bcmath, bz2, ctype, curl, dba, devel, embedded, fileinfo, fpm, gd, gmp, imap, imagick, intl, json, ldap, mbstring, memcached, mysql, mysqlnd, odbc, openssl, opcache, pdo, pear, pgsql, process, pspell, rar, redis, soap, sodium, sqlite3, ssh2, simplexml, tokenizer, xml, zip, zlib

Debian and Ubuntu

apcu, bcmath, bz2, ctype, curl, dba, dev, fileinfo, fpm, gd, gmp, imap, imagick, intl, ldap, mbstring, memcached, mysql, odbc, pdo, pgsql, pspell, redis, soap, sqlite3, ssh2, tokenizer, xml, zip

flowchart TD
    A["installphp version"] --> B["Lock, validate version"]
    B --> C{"Operating system"}
    C -- "RPM-based" --> D["dnf install php and each extension, set port, create folders"]
    C -- "Debian or Ubuntu" --> E["Purge old packages, apt install php and each extension, set port"]
    D --> F["Create /run/sock folder"]
    E --> F
    F --> G["phpini, session, web, fpm enable"]
    G --> H["Done"]

Notes for maintainers

Issue Why it matters Suggested fix
The usage message says removephp Copy-paste error. Print Usage: installphp <Version>.
The version is validated after the lock and after source /go/function A bad value still takes the lock and runs setup. The pattern also rejects versions with two-digit parts. Validate first, and allow ^[0-9]+\.[0-9]+$.
Debian and Ubuntu purge the version before installing; RPM systems don't Reinstalling wipes configuration and takes sites down on one family only. Remove the purge, or run it only with an explicit --reinstall option.
Package results are never checked The script reports completed successfully and exits 0 even if php or fpm failed. If $OS doesn't match, nothing is installed but it still reports success. Check the core packages and print a list of skipped extensions.
One package-manager call per extension Slow, and every missing package prints an error. Build a list of available packages, then install them in one call.
The extension lists include built-in or removed extensions (for example json, ctype, openssl, tokenizer, or imap on newer PHP) Noise and failed installs. Keep a list per PHP version.
chmod -R 777 /var/lib/php<digits> and chmod 777 /run/sock/<digits> Any local user can read or change other accounts' sessions and sockets. Use per-account folders and owners, as session does.
/run/sock/<digits> is created once /run is cleared at reboot, so something else must recreate it. Check that. Create it from a boot-time step or a systemd tmpfiles.d rule.
The lock expires after 10 minutes A long install can overlap with a second run. Use flock or a PID check.
The Debian branch has no sudo and no root check Fails when not run as root, unlike the RPM branch and most other commands. Re-run through sudo at the top, like the other commands.
eval $APT ... Needless use of eval. Use env DEBIAN_FRONTEND=noninteractive apt on both Debian and Ubuntu.
mkdir without -p on RPM systems Errors when a version is installed again. Use mkdir -p.
The Apache module and a2enconf run even when Nginx is active Unneeded packages and error messages. Install them only when Apache is the active server.
rm -rf /usr/local/goadmio/tmp/lock.db The purpose isn't documented. Add a comment, or remove it.

See also

Command Description
multiphp Manage PHP versions per domain
listphp List the available PHP versions on a GoAdmio server
removephp Remove a PHP version from a GoAdmio server
defaultphp Change the default PHP version in the CLI
extension List, install, or remove PHP extensions across every version
fpm Restart all installed PHP-FPM versions on your server
session Create and set permissions on PHP session directories
web Restart or reload the active web server