PHP on Linux: How to make PHP use proxy settings to connect to internet?
my server is in a LAN and is connected to internet through a Proxy Server. my PHP application (Drupal), should be able to check for updates through PHP codes. how can i set Proxy Settings for PHP so that it function properly?
Note: i know that i can set proxy settings in curl or something else. but the case is that the code is not mine and i don't wanna change it. i just want to make PHP always connect to internet through a specific proxy settings.
Solution 1:
This feature is not implementet in php, but (was) in discussion:
http://bugs.php.net/bug.php?id=29280
if you have php >= 5.3 you could use auto_prepend ini setting to include a script that uses stream_context_set_default() to set a default proxy. but this will only set a proxy for the parts of php which use the default context, didnt test it but i think curl fore example doesent.
Solution 2:
Have you tried setting environment variables?
http_proxy=http://proxy.example.com:8080