How to make PEAR work from behind an HTTP proxy (Windows and Linux)
31st May 2007
Earlier in one of my posts (Using PEAR HTTP_Client or HTTP_Request with HTTP proxy) I gave an example of using PEAR HTTP_Client and/or HTTP_Request from behind an http proxy. However, I didn’t tell how to make PEAR itself work properly from behind an HTTP proxy (e.g., for online operations like “pear upgrade-all”).
So here’s that tiny missing bit of information.
Windows:
Launch regedit, navigate to HKEY_CURRENT_USER\Environment, and create a string value called PHP_PEAR_HTTP_PROXY. Modify that new value to hold the string like: http://proxy_username:proxy_password@proxy_server_address:proxy_port.
Linux:
In the Terminal/Konsole, execute (for a system-wide pear configuration)
sudo pear config-set http_proxy http://proxy_username:proxy_password@proxy_server_address:proxy_port
If your proxy password has symbols, special for the shell (e.g. question or exclamation mark) – enclose full proxy specifications with single-quotes, e.g.
sudo pear config-set http_proxy ‘http://proxy_username:proxy_password@proxy_server_address:proxy_port’
If your HTTP proxy server does not require authentication, then use http://proxy_server_address:proxy_port instead.
I think the strings are completely self-explanatory; however, here’s an example of proxy (with authentication) specification: http://john.smith:CrAzYP433WoRd@192.168.0.1:3128.