From: nathan at inimit dot com
Operating system: Freebsd 4.8
PHP version: 4.3.7
PHP Bug Type: Apache2 related
Bug description: $_SERVER["SERVER_NAME"] and $_SERVER["HTTP_HOST"] Output the same
thing
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
[EMAIL PROTECTED]:/usr/obj/usr/src/sys/GENERIC i386
<VirtualHost *>
ServerAdmin [EMAIL PROTECTED]
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 bug report at http://bugs.php.net/?id=29083&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29083&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29083&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=29083&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29083&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29083&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29083&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29083&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29083&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29083&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29083&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29083&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29083&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29083&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29083&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29083&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29083&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29083&r=float