Skip to content

EasyApache 4 from the CLI versus the WHM UI

How to drive EasyApache 4 changes from the command line using whmapi1 ea4_* calls when the WHM UI is unavailable or when you want a scripted, repeatable provision against a saved profile.

EasyApache 4 has a perfectly good UI in WHM, and most operators only ever use it. There are three cases where the CLI is the right choice: the UI is unavailable (the WHM service is wedged but whmapi1 still works), you are running a scripted fleet-wide change, or you want a repeatable provision tied to a profile JSON in source control. The CLI surface is small but it covers everything the UI does.

What’s happening

The EasyApache 4 UI is a wrapper around a set of whmapi1 calls: ea4_list_profiles, ea4_set_profile, ea4_get_recommended_packages. The CLI calls accept a profile file path and a provision=1 flag; the rest is automated. The progress log writes to /var/cpanel/ea4/provision.log, viewable in real time. Output is JSON when called with --output=json, which makes scripting around it straightforward.

How to verify

Confirm the CLI surface is available and what is in place:

which whmapi1
whmapi1 ea4_list_profiles
whmapi1 ea4_get_recommended_packages | head
ls /etc/cpanel/ea4/profiles/
yum repolist | grep ea4

The fix

Common CLI operations:

  1. List available profiles: whmapi1 ea4_list_profiles. The output contains the path of each saved profile, including the cPanel-shipped ones and your custom ones.
  2. Provision from a saved profile: whmapi1 ea4_set_profile profile=/etc/cpanel/ea4/profiles/custom/web01-2026-05.json provision=1. The command starts the provision and returns immediately; watch progress with tail -f /var/cpanel/ea4/provision.log.
  3. Inspect a profile without applying: cat /etc/cpanel/ea4/profiles/custom/<name>.json | jq '.pkgs | length' shows the package count; jq '.pkgs[] | select(. | contains("php"))' filters to PHP packages.
  4. Dry-run the provision (does not exist as a native flag, but you can): whmapi1 ea4_set_profile profile=<path> provision=0 accepts the profile without provisioning. Useful for validating the profile JSON parses before committing.
  5. Bulk operations across hosts: with the profile JSON in version control, for host in $servers; do ssh $host whmapi1 ea4_set_profile profile=/etc/cpanel/ea4/profiles/custom/web-baseline.json provision=1; done. Watch the provision log on each host through your monitoring stack.
  6. For an even smaller surface (a one-package install without rebuilding everything): yum install -y ea-apache24-mod-http2 && /scripts/rebuildhttpdconf && apachectl -t && apachectl graceful. This skips EA4’s overhead when you only need one package added.

For environments where EA4 changes go through CI/CD against profile JSON in git, Stack Harbor builds the pipeline around the CLI calls under WHM server management.