My company uses a piece of PHP-based software that depends on $_SERVER['SERVER_NAME'] to create the URL. It runs on PHP 5.2 under Windows Server 2003 or 2008 with IIS6 or IIS7 via FastCGI.
This works “correctly” (or at least as we expect it to work) on every IIS system in which we have ever installed it. In other words, on the same server, if you call it using http://app.foo.com/myscript.php , $_SERVER['SERVER_NAME'] is 'app.foo.com', if you call it using http://192.168.1.22/myscript.php , $_SERVER['SERVER_NAME'] - "192.168.1.22", etc.
Today, for the first time, we installed it on a server (Windows Server 2003 with IIS6), which acts differently. No matter what URL we use to load the script, $ _SERVER ['SERVER_NAME'] is "myserver" (server machine name), which causes problems.
Now that this problem has occurred, we are working to eliminate the use of $_SERVER['SERVER_NAME'] in future software releases ... but is there any configuration that I can do (in IIS6, php.ini, ... ?) on this server to fix this in the meantime? If we cannot change it so that $_SERVER['SERVER_NAME'] always contains the host from the requesting URL, is there any way to configure it, so $_SERVER['SERVER_NAME'] will contain the specific desired FQDN (' app.foo.com 'instead of' myserver ')?
EDIT: Added generosity as I am very interested in getting an answer to this question.
source share