DB connection works from the CLI, but fails from within Drupal
Figured it out!

The client computer was running SELinux and was blocking outgoing connections over http. This pair of CLI command fixed it.

setsebool httpd_can_network_connect 1
setsebool -P httpd_can_network_connect 1