| 
	
 | 
 Posted by Malcolm Dew-Jones on 06/11/14 11:24 
lkrubner@geocities.com wrote: 
 
: I need for my script to be able to find out what the domain name is for 
: the site that it is running on. I looked through the $_SERVER vars, but 
: didn't see anything. 
 
I put the following in my doc area, called it "phpinfo.php", and browsed  
it. 
 
	<?php 
	phpinfo(); 
	?> 
 
On my machine I see I have environment variables called  
 
   SERVER_ADDR 127.0.0.1 
   SERVER_NAME perk.localdomain 
 
I forget how to access the environment from php, but I'm sure it's easy, 
and it might change on different php versions anyway.  You should have 
something similar, though it will also depend on the web server software. 
 
_HOWEVER_, a web server machine does not have to have a name, so you can 
not depend 100% on finding a name at all.  You might need to settle for an 
ip address. 
 
 
 
-- 
 
This space not for rent.
 
  
Navigation:
[Reply to this message] 
 |