|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29083 $_SERVER["SERVER_NAME"] and $_SERVER["HTTP_HOST"] Output the same thing
Submitted: 2004-07-10 11:52 UTC Modified: 2004-07-11 19:00 UTC
From: nathan at inimit dot com Assigned:
Status: Not a bug Package: Apache2 related
PHP Version: 4.3.7 OS: Freebsd 4.8
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
40 + 47 = ?
Subscribe to this entry?

 [2004-07-10 11:52 UTC] nathan at inimit dot com
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 4.8-RELEASE FreeBSD 4.8-RELEASE #0: Thu Apr  3 10:53:38 GMT 2003  i386

<VirtualHost *>
    DocumentRoot /domains/
    ErrorLog /domains/
    CustomLog /domains/ common

Reproduce code:


Expected result:
Result: (If on

Result: (If on

Actual result:
Result: (If on

Result: (If on


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-11 19:00 UTC]
These variables are set by the webserver, not by PHP. 
Read more at:

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri May 27 19:05:46 2022 UTC