Reply to Re: is there any way to find what the domain name is for the site that my script might be running on?

Your name:

Reply:


Posted by Malcolm Dew-Jones on 09/26/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.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация