Reputation: 66620
On shared hosting (on subdomain notes.jcubic.pl
) I've try to use:
$host = gethostname();
but got n114.domenomania.pl
(real server name) is there a way to get notes.jcubic.pl
subdomain?
Upvotes: 2
Views: 1730
Reputation: 5
you can use this also for connecting in localhost server $db_host = "localhost";
Upvotes: -1
Reputation:
For PHP >= 5.3.0 use this:
$hostname = gethostname();
For PHP < 5.3.0 but >= 4.2.0 use this:
$hostname = php_uname('n');
For PHP < 4.2.0 use this:
$hostname = getenv('HOSTNAME');
if(!$hostname) $hostname = trim(hostname
);
if(!$hostname) $hostname = exec('echo $HOSTNAME');
if(!$hostname) $hostname = preg_replace('#^\w+\s+(\w+).*$#', '$1', exec('uname -a'));
Upvotes: 0