#29083 [Opn->Bgs]: $_SERVER["SERVER_NAME"] and $_SERVER["HTTP_HOST"] Output the same thing
| From: | sniper@php.net | Date: | Sun, 11 Jul 2004 17:00:50 +0000 |
| Subject: | #29083 [Opn->Bgs]: $_SERVER["SERVER_NAME"] and $_SERVER["HTTP_HOST"] Output the same thing | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-62027@lists.php.net to get a copy of this message | ||
ID: 29083
Updated by: sniper@php.net
Reported By: nathan at inimit dot com
-Status: Open
+Status: Bogus
Bug Type: Apache2 related
Operating System: Freebsd 4.8
PHP Version: 4.3.7
New Comment:
These variables are set by the webserver, not by PHP.
Read more at:
http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server
Previous Comments:
------------------------------------------------------------------------
[2004-07-10 11:52:05] nathan at inimit dot com
Description:
------------
Based on the output, SERVER_NAME should output the ServerName value
within the VirtualHost entry within the httpd.conf while instead it is
outputing the current hostname which could be any of the ServerAlias
entries.
I have setup PHP 4.3.7 with:
'./configure' '--enable-versioning' '--enable-memory-limit'
'--with-layout=GNU' '--with-zlib-dir=/usr' '--disable-all'
'--with-regex=php' '--with-pear' '--enable-bcmath'
'--enable-ctype'
'--with-curl=/usr/local' '--with-db4=/usr/local' '--enable-dba'
'--with-dom=/usr/local' '--with-dom-xslt=/usr/local'
'--with-dom-exslt=/usr/local' '--enable-ftp' '--with-gd'
'--enable-gd-native-ttf' '--with-freetype-dir=/usr/local'
'--with-t1lib=/usr/local' '--with-jpeg-dir=/usr/local'
'--with-png-dir=/usr/local' '--with-xpm-dir=/usr/X11R6'
'--with-iconv-dir=/usr/local' '--enable-mbstring'
'--with-mcrypt=/usr/local' '--with-mhash=/usr/local'
'--with-mime-magic=/usr/share/misc/magic.mime'
'--with-mysql=/usr/local' '--with-openssl-dir=/usr/local'
'--with-openssl=/usr/local' '--enable-overload'
'--with-pcre-regex=yes'
'--enable-posix' '--with-pgsql=/usr/local' '--with-pspell=/usr/local'
'--enable-session' '--enable-sockets' '--enable-tokenizer'
'--with-expat-dir=/usr/local' '--enable-xml' '--with-xmlrpc'
'--enable-xslt' '--with-xslt-sablot=/usr/local' '--with-zlib=yes'
'--with-apxs2=/usr/local/sbin/apxs' '--x-libraries=/usr/X11R6/lib'
'--x-includes=/usr/X11R6/include' '--prefix=/usr/local'
'i386-portbld-freebsd4.8'
nshb# uname -a
FreeBSD nshb.inimit.ca 4.8-RELEASE FreeBSD 4.8-RELEASE #0: Thu Apr 3
10:53:38 GMT 2003
root@freebsd-stable.sentex.ca:/usr/obj/usr/src/sys/GENERIC i386
<VirtualHost *>
ServerAdmin webmaster@inimit.com
DocumentRoot /domains/inimit.com/www/wwwroot
ServerName inimit.com
ServerAlias www.inimit.com
ErrorLog /domains/inimit.com/www/logs/error.log
CustomLog /domains/inimit.com/www/logs/access.log common
</VirtualHost>
Reproduce code:
---------------
<?php
echo $_SERVER["SERVER_NAME"];
echo $_SERVER["HTTP_HOST"];
?>
Expected result:
----------------
Result: (If on http://inimit.com)
inimit.com
inimit.com
Result: (If on http://www.inimit.com)
inimit.com
www.inimit.com
Actual result:
--------------
Result: (If on http://inimit.com)
inimit.com
inimit.com
Result: (If on http://www.inimit.com)
www.inimit.com
www.inimit.com
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29083&edit=1