cPanel 110 PHP Version Selector defaulting to 8.3: how should integration tests handle the change?
0 reputation · 25 Oct 2021, 19:41 UTC
0 reputation · 25 Oct 2021, 19:41 UTC
With cPanel & WHM 110, the PHP Version Selector defaults to PHP 8.3 for newly provisioned accounts, while existing accounts keep their previously selected version. This creates a split behavior that automated integration tests need to account for.
A test suite that provisions fresh accounts and then validates application behavior against the account's PHP runtime can no longer assume a fixed default version. Tests written when the default was an older PHP branch may either test against the wrong runtime or fail outright if they hardcode a binary path or parse the default version from uAPI output. Because existing and new accounts behave differently after the upgrade, a single test environment may not represent both cases.
The tests should run without production credentials, ideally against a fresh cPanel 110 installation or trial license. Version changes through uAPI require appropriate permissions, so the tests cannot silently switch runtimes mid-run. Verification of the actual default can be done with whmapi1 php_get_installed_versions or via the WHM "Select PHP Version" interface.
35275 reputation · 25 Oct 2021, 20:50 UTC
Pin the PHP version for each test account at provision time using the WHM API php_set_version. If you cannot change versions, discover the effective version after account creation with the uAPI call PHPVersion get_user_php_version and adapt test expectations accordingly. Changing the server‑wide default is possible but requires root/reseller privileges and affects all accounts, so it is only advisable in isolated test environments.
Confirmed: cPanel 110 sets PHP 8.3 as the default for newly created accounts; existing accounts keep their previously selected version. The WHM API php_set_version can set a specific version per account, and the uAPI PHPVersion get_user_php_version returns the active version for a given user.
Likely explanation: Tests that assumed a static default now encounter a split behavior because fresh accounts default to 8.3 while upgraded accounts retain older versions. Without explicit versioning, test results become nondeterministic.
php_set_version for that account, specifying a known version (e.g., 8.2) that your application supports.php_set_version, after provisioning retrieve the active version with uapi --user=<account> PHPVersion get_user_php_version and adjust assertions to match the returned value.Maintain two fixtures:
Run the same test suite against each fixture; the only difference is the expected PHP version, which you can obtain from the fixture metadata or via the discovery API call.
Do you have root or reseller privileges on the test cPanel server? If you do not have such privileges, you cannot change the server‑wide default with php_set_vhost_versions, and the only reliable options are to pin per‑account versions (if allowed) or to discover and adapt. If you do have privileged access, you may set a server‑wide default for the reseller owning the test accounts to keep fixtures stable across upgrades, but remember that this change affects every account under that reseller.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.