Skip to content

Recovering from an EasyApache 4 rebuild that left Apache down

A field-tested sequence for getting Apache back up after an EasyApache 4 provision fails halfway through and the running config is neither the old build nor the new one.

EasyApache 4 is reasonably resilient, but a failed provision — disk full mid-RPM, mirror flake, a missing PHP extension — leaves the server in a state where Apache will not start, modules are half-installed, and the WHM UI keeps redirecting you to the failed task page. The recovery sequence is mechanical, not heroic. The mistake people make is to immediately re-run the provision; the right move is to diagnose what is half-installed first.

What’s happening

An EasyApache 4 provision is a sequence of RPM transactions plus a final httpd -t and restart. When the transaction fails, the package manager leaves whatever has been installed in place. Apache may now be linked against a PHP module that was not installed, or against a new MPM that conflicts with a still-loaded old MPM. The /etc/apache2/conf.d/ tree is regenerated by EasyApache before the RPM step, so the on-disk config already references modules that may not exist on disk.

How to verify

Confirm Apache is genuinely down and find out why:

systemctl status httpd
apachectl -t
apachectl -M 2>&1 | head -40
journalctl -u httpd --since "1 hour ago" | tail -50
cat /var/cpanel/ea4/provision.log | tail -60
yum history list | head

apachectl -t will usually print the exact missing module. yum history shows the failed transaction ID so you can inspect what got partway installed.

The fix

  1. Pull the failed transaction ID from yum history and inspect it: yum history info <id>. Note what was installed and what was supposed to be installed but was not.
  2. Do not roll back the transaction yet. First, try to complete the failed install: yum-complete-transaction --cleanup-only followed by yum install <missing-package>. If the missing package is a PHP module like ea-php82-php-mysqlnd, install it directly.
  3. With the missing pieces in place, re-run apachectl -t. If the config now passes, systemctl start httpd and confirm with apachectl -M.
  4. If the config still fails because EasyApache rewrote /etc/apache2/conf.d/ referencing modules you no longer want, regenerate the include from the last saved profile: whmapi1 ea4_set_profile profile=/etc/cpanel/ea4/profiles/custom/<your-known-good>.json provision=1. Watch the provision log in real time in another tty: tail -f /var/cpanel/ea4/provision.log.
  5. Once Apache is back up, run /scripts/rebuildhttpdconf to force cPanel to regenerate every vhost include from the userdata cache, then apachectl graceful.
  6. Post-incident: confirm /etc/cpanel/ea4/profiles/custom/ contains a profile that matches the now-running build. If not, save one (see the companion article on saving custom EA4 profiles).

For sites where a failed EA4 rebuild is a customer-facing incident, Stack Harbor runs every EasyApache change against a canary profile first under managed cPanel operations.