ryogesh1508 Posted September 6, 2010 Share Posted September 6, 2010 pls help me.. i am new to PHP unit testing concept. i just wrote a PHP unit test case for a login module in ZEND frame work. for that we have to see the result via command promt. but in some places of zend frame work we are using '$_SERVER['HTTP_HOST']' to get server host name but it can get only by hitting via browser so while am hitting via command promt it will give error message lik this(given below) Generating code coverage report, this may take a moment.PHP Notice: Undefined index: HTTP_HOST in /opt/coolstack/apache2/htdocs/LPS/application/bootstrap/Bootstrap.php on line 147 Notice: Undefined index: HTTP_HOST in /opt/coolstack/apache2/htdocs/LPS/application/bootstrap/Bootstrap.php on line 147 PHP Notice: Undefined index: HTTP_HOST in /opt/coolstack/apache2/htdocs/LPS/application/bootstrap/Bootstrap.php on line 197 Notice: Undefined index: HTTP_HOST in /opt/coolstack/apache2/htdocs/LPS/application/bootstrap/Bootstrap.php on line 197 PHP Notice: Undefined index: HTTP_HOST in /opt/coolstack/apache2/htdocs/LPS/library/Zaah/Controller/Plugin/Ssl.php on line 79 Notice: Undefined index: HTTP_HOST in /opt/coolstack/apache2/htdocs/LPS/library/Zaah/Controller/Plugin/Ssl.php on line 79 i cant give server host name at all the places. so please help me how to solve this problem.... thanks Yogesh Quote Link to comment https://forums.phpfreaks.com/topic/212660-php-unit-testing-_serverhttp_host-problem-while-hitting-via-command-promt/ Share on other sites More sharing options...
ignace Posted September 6, 2010 Share Posted September 6, 2010 Please keep it to one topic http://www.phpfreaks.com/forums/index.php/topic,309278.0/topicseen.html Quote Link to comment https://forums.phpfreaks.com/topic/212660-php-unit-testing-_serverhttp_host-problem-while-hitting-via-command-promt/#findComment-1107814 Share on other sites More sharing options...
rwwd Posted September 6, 2010 Share Posted September 6, 2010 Hi there, could you post the code that is relevant to the lines in question, usually you will get that error if there are no quotes around the value within the global ($_SERVER[HTTP_HOST]). It should read: $_SERVER['HTTP_HOST'], but be wary though as the value will only be there if it is set. >>Contents of the Host: header from the current request, if there is one. See this:http://www.php.net/manual/en/reserved.variables.server.php Hope that makes sense anyway, Cheers, Rw Quote Link to comment https://forums.phpfreaks.com/topic/212660-php-unit-testing-_serverhttp_host-problem-while-hitting-via-command-promt/#findComment-1107816 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.