Php – Force all outbound HTTP connections through a proxy

debianfirewallPHPPROXY

We run a few society websites behind a University firewall that mandates that all traffic goes through an internal squid cache / proxy.

While export http_proxy= works perfectly in the shell I'm wondering if there's a similarly easy way to force PHP applications, such as MediaWiki and WordPress to use and recognise that environment variable. We're running Debian 5.

I found a way to do it once without having to use a local transparent proxy… I just can't remember how.

Best Answer

This could be achieved through using iptables / netfilter http://www.netfilter.org/