$_SERVER problem
Moderator: General Moderators
- softsolvers
- Forum Commoner
- Posts: 75
- Joined: Fri Feb 13, 2004 4:26 am
- Location: India
$_SERVER problem
Hello friends,
I am unable to find the ip address of the server,i am using following code.
<?php
echo $_SERVER['SERVER_ADDR'];
?>
But i am unable to see the address, i have register_global=on in my php.ini file is it make any problem .In a project i have to put register_global to on ,now how can i view the ip address of the server.
Plz. suggest me
Softsolvers
I am unable to find the ip address of the server,i am using following code.
<?php
echo $_SERVER['SERVER_ADDR'];
?>
But i am unable to see the address, i have register_global=on in my php.ini file is it make any problem .In a project i have to put register_global to on ,now how can i view the ip address of the server.
Plz. suggest me
Softsolvers
its
Code: Select all
$_SERVERї"HTTP_HOST"];-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
No evilcoder it is not. HTTP_HOST wil echo out the host. Like google.com or forums.devnetwork.netevilcoder wrote:itsCode: Select all
$_SERVERї"HTTP_HOST"];
-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
you might want to try:
Code: Select all
echo getenv("SERVER_ADDR");-
penguinboy
- Forum Contributor
- Posts: 171
- Joined: Thu Nov 07, 2002 11:25 am
Try:
Among others; you'll see:
I believe it is undocumented.
Code: Select all
print '<pre>';
print_r($_SERVER);Code: Select all
$_SERVER['SERVER_ADDR']-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
What's available in the $_SERVER array is governed by the server - not all elements will be available on all servers, best thing to do is what penguinboy suggested -
that way you can see what's available on your server and can find the information you are looking for.
Mac
Code: Select all
echo '<pre>';
print_r($_SERVER);
echo '</pre>';Mac