I use php to get the IP:
$ip = getenv("REMOTE_ADDR");

Could there be a case when $ip is undefined?

Thanks