TL;DR: Is there a runtime or php.ini directive for IP/network interface?
Setup: Debian, NginX, php-fpm
The machine has multiple IPs configured in the network interfaces. Each virtual host in NginX is listening to a specific IP. If there is any networking related action performed by PHP, for example a cURL call, the default IP is used every time. If I set CURLOPT_INTERFACE manually in a script, the correct ip is being used, but I need to do this automatically somehow via NginX vhost and php-fpm handshake.
So, site1.com get's called, somehow it needs to pass the ip that that site is listening on to the php-fpm and php-fpm needs to set it as the network interface to use for any Internet connections php will make during execution, be it cURL, get_file_contents(), or any other function.
Can this be done?
Thanks