Forum Moderators: coopster

Message Too Old, No Replies

php include problem

         

sned

11:55 pm on Sep 8, 2006 (gmt 0)

10+ Year Member



include_path = '/var/www/html'

I use a database abstraction class, I use mainly a live class included like this: include('includes/class_Database.php');

Now, I'm trying to test some other things out, with a new database class. I'm including this class like this:

include('/var/www/html/test/include/class_Database.php');

By throwing an echo statement into the test class_Database.php file, I can see that it is included.

However, php seems to think I'm trying to instantiate the original database class: Cannot redeclare class database in /var/www/html/includes/class_Database.php

This error spits out even though I don't reference that file anywhere in my code ... I'm stumped on this one. Anybody have any ideas?

Thanks,
sned

coopster

2:33 am on Sep 9, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You don't have it included in an auto_prepend or another included file somewhere, do you? Have you looked at what file and line the error is coming in at?

sned

2:44 pm on Sep 11, 2006 (gmt 0)

10+ Year Member



It's not in an auto-prepend, the error is happening on the line where I start the class: (both classes are named class Database in each separate file)

class Database{

avladu

3:43 pm on Sep 11, 2006 (gmt 0)

10+ Year Member



dear sned,

pleasde take a look an all the files that are included, most probably you have 2 or more definitions for this class "database". The error occurs because you canot redeclare and exiting function, class, etc even if these classes, functions are in separated files files but are included on the working file.

Hope that's help.

Best Regards,
Aurel Vladu