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?
Are you looking lot the $_SERVER['HTTP_HOST']?
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'));
you can use this also for connecting in localhost server $db_host = "localhost";