bcamp1973 Posted May 16, 2006 Share Posted May 16, 2006 I run a local dev environment and i want to put a <base href=""> tag in my dev sites so my colleagues can look at things as i'm working on them. So, say my ip is 123.45.67.01 and my project is in the "proj01" directory. I want to use PHP to build the following <base> tag...[code]<base href="http://123.45.67.01/proj01/" />[/code]obviously $_SERVER['HTTP_HOST'] doesn't work...is there a field in the server array for the IP address (and i don't mean 127.0.0.1) or any other way to capture that information? Quote Link to comment Share on other sites More sharing options...
.josh Posted May 16, 2006 Share Posted May 16, 2006 $_SERVER['SERVER_ADDR'] Quote Link to comment Share on other sites More sharing options...
bcamp1973 Posted May 16, 2006 Author Share Posted May 16, 2006 [!--quoteo(post=374471:date=May 16 2006, 07:06 PM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ May 16 2006, 07:06 PM) [snapback]374471[/snapback][/div][div class=\'quotemain\'][!--quotec--]$_SERVER['SERVER_ADDR'][/quote]unfortunately that gives me "127.0.0.1", not the IP my colleagues need to access my macine :( Quote Link to comment Share on other sites More sharing options...
.josh Posted May 16, 2006 Share Posted May 16, 2006 really? hmm. well i tested it on my host and it seemed to work just fine? i'm not an expert so i couldn't tell you why it doesn't work. sorry... Quote Link to comment Share on other sites More sharing options...
exeterdad Posted May 17, 2006 Share Posted May 17, 2006 Either one should work!?Are you accessing the script with [a href=\"http://localhost\" target=\"_blank\"]http://localhost[/a] or 127.0.0.1 (loopback) or [a href=\"http://yourIPaddresshere\" target=\"_blank\"]http://yourIPaddresshere[/a]?All of them make a difference. Obviously your colleagues will have to use [a href=\"http://yourIPaddresshere\" target=\"_blank\"]http://yourIPaddresshere[/a] since they are outside of your network.Try it, I bet it works [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] Easy way to test which one works for you is to run phpinfo() with all three methods mentioned above. You will see the difference. Quote Link to comment Share on other sites More sharing options...
bcamp1973 Posted May 17, 2006 Author Share Posted May 17, 2006 [!--quoteo(post=374517:date=May 16 2006, 09:48 PM:name=exeterdad)--][div class=\'quotetop\']QUOTE(exeterdad @ May 16 2006, 09:48 PM) [snapback]374517[/snapback][/div][div class=\'quotemain\'][!--quotec--]Either one should work!?[/quote]ok, i'm an idiot. You're both right, it does work. The only failure here was my typing skills. I overlooked a typo. THanks to you both! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.