39

Initially I used the following with no success;

export http_proxy=http://username@password:host:port

Worth noting I don't get a connection error directly, instead;

[root@pal ~]# sudo pear info  PHP_CodeSniffer-1.2.1
No information found for `PHP_CodeSniffer-1.2.1'
Daniel Morris
  • 6,852
  • 8
  • 25
  • 30

4 Answers4

103

Instead of using the system's http_proxy, set the proxy directly in pear's config;

pear config-set http_proxy http://username:password@yourproxy:80
Daniel Morris
  • 6,852
  • 8
  • 25
  • 30
  • 2
    Attention with special characters in the password like ! or @, we must use html code in hexadecimal, for example the char ! is %21. – Aron Dec 11 '13 at 14:38
  • 1
    To everyone that tries using `pecl`, `config-set` must be used via: `pear` – Anuga Jan 11 '22 at 13:58
18

You also may have an issue with your sudo user having different configuration from your user for pear.

If you make this :

pear config-set http_proxy http://username:password@yourproxy:80

Then

sudo pear channel-discover pear.symfony-project.com

You have change user and the proxy is still not set.

So use the appropriate command:

sudo pear config-set http_proxy http://username:password@yourproxy:80

(Issue spotted on Ubuntu 11.04 fresh install)

Damien
  • 5,872
  • 2
  • 29
  • 35
  • Or run `sudo -E channel-discover pear.symfony-project.com` to preserve environment variables if the proxy is set for the current user. – oldwizard Aug 15 '16 at 12:14
8

Note that pear config-set http_proxy works whereby pecl config-set http_proxy does not, even though pecl config-get http_proxy does.

That one cost me me quite a bit of hair pulling :-)

joshmcode
  • 3,471
  • 1
  • 35
  • 50
boran
  • 361
  • 2
  • 7
7

This will remove proxy settings:

pear config-set http_proxy ""
aurbano
  • 3,324
  • 1
  • 25
  • 39
czezz
  • 79
  • 1
  • 2