homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Dynamic Local IP (192.168.x.x) as ServerName instead of static IP?
ServerName sets PHP's $_SERVER['SERVER_ADDR'] to
JAB Creations

 9:20 pm on Feb 14, 2009 (gmt 0)

I've messed with the hosts file in XP and have been reading through the documentation on Apache's site and haven't found anything that I could use to force Apache to use my machine's local IP (192.168.x.x) as the ServerName in httpd.conf. My local IP changes as I have to take my system with me on occasion so from my understanding if I want to echo PHP's $_SERVER['SERVER_ADDR'] as my local IP instead of I will have to change Apache's ServerName to use my computer's local network's IP. From everything that I've tried it seems I somehow have to opt-in to doing this. I also can not rely on manually setting any host file on any machine except my own though if I have to do so it should only be once in the desired scenario.

So ultimately how do I force Apache to set PHP's $_SERVER['SERVER_ADDR'] IP to my dynamic local network IP instead of I am not using any virtual hosts if that is an important factor to consider.

- John


JAB Creations

 9:43 pm on Feb 14, 2009 (gmt 0)

Pilot error! I was not requesting from a network IP however once I did everything seemed to work fine. I commented out all my hosts and httpd.conf changes, restarted the Apache service, and everything runs clean. When I changed my network IP it still ran smoothly so I've resolved the issue. :)

- John

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved