Page 1 of 1

getting server name

Posted: Sun Dec 26, 2004 2:14 am
by pelegk2
when i use the $_SERVER['SERVER_name']
i am reciving the ip of the server i run on and not its name for example!!!
why is that?
thnaks i advance
peleg

Posted: Sun Dec 26, 2004 2:23 am
by feyd
Predefined Variables wrote:'SERVER_NAME'

The name of the server host under which the current script is executing. If the script is running on a virtual host, this will be the value defined for that virtual host.
basically, http://localhost/blah.php -> localhost ; http://192.168.0.0/blah.php -> 192.168.0.0 ..

ok in my case i use the computers names

Posted: Sun Dec 26, 2004 6:01 am
by pelegk2
i use the computers names as my server names!
how can i get the computer name?
thnaks in advance
peleg

Posted: Sun Dec 26, 2004 1:40 pm
by rehfeld
you could prob get the computer name by using exec() somehow,
but i dont know what the command is


print_r($_SERVER);

see if theres anything you could use in there.

if you need to use names:
a- create a unique config file for each script, putting the corresponding server name into it
b- set up apache to use virtual hosts so you can name them

if u want to use virtual hosts and cant figure out how,
tell us what version of apache and what o/s your using and we can help.

Posted: Sun Dec 26, 2004 5:27 pm
by timvw
i remember that i've once explained how to do it for
windows 9x to xp and linux in the apache-iis section...

ok i have :

Posted: Mon Dec 27, 2004 5:38 am
by pelegk2
apache 2.0.46 and php 4.3.2
i have apache 1 on : windows 2000 and 1 on windows 2003 server
so how do i configure virtual hosts for them>??can i config more then 1 domain on a pc?and how other users in my network - how here pc's will find each of the "domain" we configure?
and more then that
how can i redirect a certain "domain" from one serve to another?
thnaks i nadvance
peleg