Skip to content

Rolling back an EasyApache 4 build to the previous known-good profile

How to revert an EasyApache 4 provision when the new build introduced a regression — using saved profiles and yum history rather than guessing at module names.

A clean EasyApache 4 provision can still leave you with a broken site. The most common pattern: PHP got upgraded from 8.1 to 8.2, a vhost depends on a module that was renamed or removed, and the customer is on the phone. Rolling back is not the same as “undo.” The route is to re-provision the previous profile from disk, not to fight yum on individual packages.

What’s happening

EasyApache 4 does not maintain its own rollback record. Each provision writes a new state to /var/cpanel/ea4/ and updates yum transactions. The previous profile is only present on disk if you saved it before the change — which is why “save profile before every change” is a non-negotiable habit on a managed server. With a saved profile, rollback is a single whmapi1 call. Without one, you are reconstructing the previous build from yum history and memory.

How to verify

Establish what changed and what to roll back to:

ls -la /etc/cpanel/ea4/profiles/custom/
ls -la /etc/cpanel/ea4/profiles/cpanel/
yum history list httpd | head
yum history info <last-transaction-id>
rpm -qa | grep ea-php | sort

The custom profile directory should contain the build you were on before the change. If it does not, look at the yum history info output for the failed transaction to see exactly which packages were swapped.

The fix

Path A — you saved a profile before the change:

  1. Confirm the previous profile file exists and matches what was running yesterday: cat /etc/cpanel/ea4/profiles/custom/<previous>.json | jq '.pkgs | length'.
  2. Reprovision from that profile: whmapi1 ea4_set_profile profile=/etc/cpanel/ea4/profiles/custom/<previous>.json provision=1.
  3. Watch the run: tail -f /var/cpanel/ea4/provision.log. Expect package downgrades and removals; do not interrupt.
  4. After the run, apachectl -t && systemctl status httpd and a synthetic check against a known account.

Path B — no saved profile, only yum history:

  1. Identify the bad transaction: yum history list httpd and note the ID immediately following the last known-good state.
  2. Undo just that transaction: yum history undo <id>. This rolls back the RPM step but does not touch EasyApache’s generated config in /etc/apache2/conf.d/.
  3. Regenerate Apache config to match the now-installed RPMs: /scripts/rebuildhttpdconf and apachectl -t. Fix any module references left over.
  4. Immediately save the now-restored state as a profile so the next rollback is a Path A: walk WHM > EasyApache 4 > Customize > Save as Profile.

For environments where every EA4 change needs a reliable rollback path, Stack Harbor includes profile discipline as part of cPanel server administration.