Hello all, I am VERY new to PHP and this site. I just upgraded the PHP on our server (Windows 2000 server using IIS, not Apache) to PHP5. Since then our site stopped working.
This is the error we're getting in the error log:
PHP Fatal Error: Cannot redeclare http_build_query() in C:\oneorzero\common\common.php on line 4421
Here is the code in question:
<?php
// 03/27/06 - Added HTTP Build Query
if(!defined('http_build_query'))
{
function http_build_query($array, $flags='', $flags_unchecked=TRUE, $index="")
{
if($flags_unchecked)
{
if(is_string($flags))
{
$flags = ereg_replace("[^a-z0-9_]", "", $flags);
}
else
{
$flags = '';
}
}
$string = "";
if(is_array($array))
{
foreach($array as $name => $value)
{
if(is_array($value))
{
if($index=="")
{
$string.=http_build_query($value, $flags, FALSE, $name);
}
else
{
$string.=http_build_query($value, $flags, FALSE, $index."[".$name."]");
}
}
else
{
if($index=="")
{
if(is_int($name))
{
$name=$flags.$name;
}
$string .= $name . "=" . urlencode($value) . "&";
}
else
{
$string .= $index . "[" . $name . "]=" . urlencode($value) . "&";
}
}
}
if($index=="")
{
$string=ereg_replace("&$","",$string);
}
}
return $string;
}
}
?>
This was working before we upgraded PHP. What could be the problem?