Page 1 of 1

Fatal error: Cannot redeclare serendipity_db_update()

Posted: Sun Mar 19, 2006 5:46 pm
by jholovacs
Hello,

I'm developing a website on my test server (WinXP Pro, IIS, MySQL 5, PHP 5.1.2 ISAPI). I dropped the files to /blog/ off the root. First time I linked to it, I got the admin page, I put my settings in, all seemed well. I click the "Complete Installation" button and after a short pause I get this:

Fatal error: Cannot redeclare serendipity_db_update() (previously declared in G:\TestWeb\blog\include\db\db.inc.php:9) in g:\TestWeb\blog\include\db\db.inc.php on line 33

This is lines 9 thru 33:

function serendipity_db_update($table, $keys, $values)
{
global $serendipity;

$set = '';

foreach ($values as $k => $v) {
if (strlen($set))
$set .= ', ';
$set .= $k . '=\'' . serendipity_db_escape_string($v) . '\'';
}

$where = '';
foreach ($keys as $k => $v) {
if (strlen($where))
$where .= ' AND ';
$where .= $k . '=\'' . serendipity_db_escape_string($v) . '\'';
}

if (strlen($where)) {
$where = " WHERE $where";
}

return serendipity_db_query("UPDATE {$serendipity['dbPrefix']}$table SET $set $where");
}

Now I'm no PHP guru (pretty much a straight newbie on web design and functionality), but I know a bit about scripting and I can't see how the function in question is being redeclared... Line 9 is the function declaration and line 33 in the end bracket "}". Is this a permissions thing, a configuration thing, something with my PHP settings? I just don't know enough about this.

This is a brand new install, v0.9.1.

Thanks for your help!

-Jeremy

Re: Fatal error: Cannot redeclare serendipity_db_update()

Posted: Mon Mar 20, 2006 10:19 am
by garvinhicking
Hi!

Somehow your webserver seems to include files twice. The db.inc.php file should only be included once, and I don't know how it comes that it is included twice in your system?

I don't know IIS very well, can it be that it is somehow misconfigured so that PHP files are rendered/executed twice?

Regards,
Garvin

Posted: Wed Mar 22, 2006 4:59 pm
by jholovacs
**sigh**

I hope not. This promises to make things more interesting than I want them to be. Thanks for pointing me in the right direction.

-Jeremy