Forum Moderators: coopster

Message Too Old, No Replies

Server IP

Retrieving the servers IP

         

Stuperfied

6:53 am on Jun 19, 2007 (gmt 0)

10+ Year Member



I have an apache server on my WinBox with PHP/MySQL. Using a free domain name service to redirect traffic to the server as DNS Host A, the invision message board fails when users click on links. To correct this, I have had to enter the servers IP directly into the conf_global.php file. The problem is that the servers IP is dynamic on dial up and so has to be re-entered into the conf_global.php file each time the server is reconnected to the internet.

Is there a way of automatically retrieving the IP?

Habtom

7:58 am on Jun 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



$_SERVER['SERVER_ADDR']

I think this should do it. If not, what you are looking for is most likely to be in this link [us3.php.net]

Habtom

Stuperfied

8:23 am on Jun 19, 2007 (gmt 0)

10+ Year Member



Thanks, it seems to be working but wont know for sure yet cause there is heavy traffic in my area at the moment which is causing the pages to error out. The other solution I tried which worked is to get the IP from the redirect as follows.

$IP = gethostbyname('www.example.com');