Similar question has been asked in stackoverflow before.
See here: PHP $_SERVER[‘HTTP_HOST’] vs. $_SERVER[‘SERVER_NAME’], am I understanding the man pages correctly?
Also see this article: http://shiflett.org/blog/2006/mar/server-name-versus-http-host
Recommended using HTTP_HOST, and falling back on SERVER_NAME only if HTTP_HOST was not set. He said that SERVER_NAME could be unreliable on the server for a variety of reasons, including:
- no DNS support
- misconfigured
- behind load balancing software
Source: http://discussion.dreamhost.com/thread-4388.html
Related Posts:
- Google Calendar API event update always return 404 “not found” error
- navigate back with PHP form submission
- Difference between “as $key => $value” and “as $value” in PHP foreach
- How do I get a YouTube video thumbnail from the YouTube API?
- How to avoid Request Entity Too Large 413 error
- Should I use mysqli_real_escape string() or mysql_real_escape_string() for form data?
- currently unable to handle this request HTTP ERROR 500
- How to fix “Headers already sent” error in PHP
- “Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP
- PDOException SQLSTATE[HY000] [2002] No such file or directory
- http://localhost:80 is not working on running Apache server through UniServer ZeroXIII
- What are the main differences between PHPExcel and PhpSpreadsheet?
- Getting an error when I visit http://localhost
- XAMPP Port 80 in use by “Unable to open process” with PID 4
- PHP random string generator
- Regex to check for new line
- Elegant way to search for UTF-8 files with BOM?
- Can you “compile” PHP code and upload a binary-ish file, which will just be run by the byte code interpreter?
- Is SAJAX dead? What to replace with?
- Invalid argument supplied for foreach()
- Remove the last character from a string
- How to prevent Browser cache for php site
- break out of if and foreach
- Redirect vs RedirectMatch
- what does a .php?id=&value=value means?
- Setting up a PHP interpreter in PhpStorm
- Can curl make a connection to any TCP ports, not just HTTP/HTTPS?
- Error 330 (net::ERR_CONTENT_DECODING_FAILED):
- What does __FILE__ mean?
- Fatal error: Call to a member function bind_param() on boolean [duplicate]
- How do I fix “Undefined variable” error in PHP?
- How do I get a YouTube video thumbnail from the YouTube API?
- How do you parse and process HTML/XML in PHP?
- Is there a difference between the UTC and Etc/UTC time zones?
- Fatal error: Call to a member function prepare() on null
- PHP mail not working for some reason
- move_uploaded_file gives “failed to open stream: Permission denied” error
- PHP convert XML to JSON
- PHP if not statements
- PHP with MySQL 8.0+ error: The server requested authentication method unknown to the client
- WordPress Error : Upload folder is not writable. Export and file upload features will not be functional
- how to get id from URL using php
- What does it mean to escape a string?
- Creating default object from empty value in PHP?
- MAMP “Apache couldn’t be started because port is in use.” AND “Can’t connect to local MySQL server through /tmp/mysql.sock
- Php include not working? function not being included
- Send attachments with PHP Mail()?
- PHP mail function doesn’t complete sending of e-mail
- Convert php array to Javascript
- phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user ‘pma’@’localhost’ (using password: NO)
- SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens on line 102
- Fatal error: Call to undefined function money_format()
- What does MYSQLI_NUM mean and do?
- Fatal Error: Allowed Memory Size of 134217728 Bytes Exhausted (CodeIgniter + XML-RPC)
- Laravel 5 Clear Views Cache
- phpinfo() is not working on my CentOS server
- ERROR: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it
- What does double question mark (??) operator mean in PHP
- How can I find the php.ini file used by the command line?
- Check if a PHP cookie exists and if not set its value
- Deprecated: mysql_query() [duplicate]
- Call to undefined function mysql_query() with Login [duplicate]
- Is there a function to make a copy of a PHP array to another?
- How to POST JSON Data With PHP cURL?
- cURL request in Laravel
- htmlentities() vs. htmlspecialchars()
- PHP array printing using a loop
- How to send to BCC address when using PHPMailer to format MIME message for Gmail API?
- Fastest way to implode an associative array with keys
- PhpMailer SMTP NOTICE: EOF caught while checking if connected
- Facebook – Error parsing input URL, no data was cached, or no data was scraped
- Is there any way to test PHP locally without installing a server?
- PHP Redirect with POST data
- How to use $_SERVER[‘HTTP_REFERER’] correctly in php?
- what is $_SERVER[‘QUERY_STRING’] ? how it works?
- Getting the screen resolution using PHP
- PHP Error : Fatal error: Constant expression contains invalid operations
- JavaScript equivalent of PHP’s in_array()
- Create a folder if it doesn’t already exist
- Implement linked list in php
- Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
- PHP: date function to get month of the current date
- How to make PDF file downloadable in HTML link?
- What is a templating language?
- How to generate .json file with PHP?
- Logout button php
- Determining Referer in PHP
- Unset cookies php
- Call to a member function on a non-object [duplicate]
- PHP Like thing similar to MySQL Like, for if statement?
- Redirecting from HTTP to HTTPS with PHP
- PHP syntax question: What does the question mark and colon mean? [duplicate]
- Generate PDF from HTML PHP
- PHP & Case Sensitivity
- Call to a member function fetch_assoc() on boolean in
[duplicate] - PHP Header redirect not working [duplicate]
- How to use Memcached with PHP7?
- Remove empty array elements
- select count(*) from table of mysql in php
- Auto increment in phpmyadmin