I've made a few checks.
$_Server["SERVER_ADDR"] = Doesnt work on Windows / IIS
$_Server["LOCAL_ADDR"] = is the same as $_Server["SERVER_ADDR"] on unix, does give the external IP
$_SERVER["REMOTE_ADDR"] = Returns external IP
gethostbyname($_SERVER["SERVER_NAME"]) = Returns external IP
I geuss that's the Problem. Trying to search the MySQL Server on the external Network doesn't work. It is not accesssable from the outside.
So how do I Change this so that the internal IP get's used?