Skip navigation

Conditional Logic in global.inc to define $conf array

Help

Conditional Logic in global.inc to define $conf array

Hello,

I am looking to add some logic -- something to this effect -- in global.inc:

$server_ip = getenv(SERVER_ADDR) (or $_SERVER['SERVER_ADDR'])
if $server_ip is server1_ip or server2_ip
$conf[memacache_servers] = array(server1_ip => default, server2_ip => default)
else
$conf[memacache_servers] = array(server3_ip => default)

However, server_ip always appears to be 127.0.0.1.

server1 and server2 are behind a load balancer; server3 is a disaster-recovery server, and located off site. How does one configure this type of logic in global.inc, assuming that is the right place for it.

Thoughts? Ideas?

#1

Found it:

$server_ip = getHostByName(php_uname('n'))
More at: http://stackoverflow.com/questions/3202872/php-serverserver-addr-variabl...

Need help?

Discussion

The discussion area lets your team communicate by posting updates and discussing issues. It is a great place for sharing progress, discussing challenges, and exploring ideas.