Most of the time, installing tools using Homebrew works flawlessly, including PHP these days. However, having to work in a client environment requiring a proxy, the PHP 8.1 post-install failed when updating Pear/Pecl channels, although the usual
https_proxy were set and worked normally, including for the other Homebrew tasks. What could be going on ?
Turns out, the culprit is
pear, which does not use those standard environment variables, but needs its own configuration, which is documented on https://pear.php.net/manual/en/guide.users.commandline.config.php
The key is to simply add that config from the Pear CLI:
pear config-set http_proxy http://(proxy IP):(proxy port)
pear update-channels works..
.. and so do
brew install email@example.com, or just
brew postinstall firstname.lastname@example.org if you got tired of waiting for a timeout in
brew install email@example.com and killed it with ^C.
That's all it takes!