Setting the proxy systemwide
These exports can be applied to set a systemwide proxy to your console in Linux and Mac OSX.
1 2 3 4 |
export http_proxy="http://192.168.1.100:8080" export https_proxy="http://192.168.1.100:8080" |
Make PECL / PEAR use the Proxy
PEAR / PECL won’t use the system proxy, instead you have to set it manually.
Due to a bug in those tools, PECL throws an error whenever you try to set something. Setting a value for PEAR also does it to PECL then:
1 2 3 4 |
vagrant@vagrant-ubuntu-precise-64:~$ pear config-set http_proxy 127.0.0.1:80 config-set succeeded |
1 2 3 4 |
vagrant@vagrant-ubuntu-precise-64:~$ pecl config-set http_proxy 127.0.0.1:80 config-set (http_proxy, 127.0.0.1:80, user) failed, channel pecl.php.net |
Both are set now.
Manually compiling a Module
If you don’t want to rely on PECL / PEAR, you can manually do what they do.
Example using the Mongo extension:
1 2 3 4 5 6 7 8 |
wget http://pecl.php.net/get/mongo-1.6.8.tgz tar xzf mongo-1.6.8.tgz cd mongo-1* phpize ./configure --enable-mongo --with-php-config=php-config --prefix=/usr/lib/php5/ make && make install |
This is useful when you setup a virtual machine (with vagrant for example), work behind a proxy in your company or school, or your serverfarm using a proxy.