Topshed Posted February 18, 2008 Share Posted February 18, 2008 Hi, I am trying to get a "contact me script" to work but an error in the config file is giving me problems but it is something not to be edited /// edit end $urlh = getenv(HTTP_HOST); $siteurl = "http://$urlh"; ?> The error it get is Use of undefined constant HTTP_HOST - assumed 'HTTP_HOST' in \contact\config.php on line 7 I googled the problem and as far as I can tell, it may be because I am using a windows host rather than unix any help / suggestions please Thanks topshed Link to comment https://forums.phpfreaks.com/topic/91672-unsure-about-error/ Share on other sites More sharing options...
trq Posted February 18, 2008 Share Posted February 18, 2008 It is simply due to poor coding. The getenv() function expects a string. Change... $urlh = getenv(HTTP_HOST); to.... $urlh = getenv('HTTP_HOST'); I would probably consider using another contact me script, this is a simple mistake and one that should not be made by any decent developer. Link to comment https://forums.phpfreaks.com/topic/91672-unsure-about-error/#findComment-469502 Share on other sites More sharing options...
aschk Posted February 18, 2008 Share Posted February 18, 2008 Well, the error was in fact corrected by the PHP runtime, turning HTTP_HOST into 'HTTP_HOST', so I suspect the problem IS actually related to your operating system. Environmental variables are NOT to be trusted between windows and linux, hence HTTP_HOST might exist on 1 and not the other. Instead I would rely on the $_SERVER variables as MOST of these are populated with the information you want. Link to comment https://forums.phpfreaks.com/topic/91672-unsure-about-error/#findComment-469514 Share on other sites More sharing options...
redarrow Posted February 18, 2008 Share Posted February 18, 2008 added comment php shown u what to add look closly Use of undefined constant HTTP_HOST - assumed 'HTTP_HOST' in \contact\config.php on line 7 'HTTP_HOST' Link to comment https://forums.phpfreaks.com/topic/91672-unsure-about-error/#findComment-469520 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.