In that you should replace ALL require()'s with require_once() in all files, not just in index.php. If you import a file with 'include_once' or 'require_once' then try to 'include' or 'require' it again afterwards, you don't get the benefit of php checking if the file is already present.
include_once and require_once are one solution, but not the optimal solution because they cause a large performance hit. The best solution would be to sort out your file inclusion logic. Maybe do all includes in one file and only include that file from your other content pages....
Were you including core.php from config.php? That also could have caused the error...
In smaller applications it really isn't a "valid" performance problem as you're mostly only including a couple files. But, consider a larger application with a couple hundred includes and complex auto-loading routines, suddenly you're going to start noticing it. Now add a decent amount of traffic, you're probably going to need load-balanced front ends which are probably going to have an NFS mount (big delay in file read times) and suddenly every millisecond is critical. Just because it isn't "necessary" to follow best practice rules doesn't mean you shouldn't do it. Why promote bad habits....? </pet peeve rant> :D
So what you're saying is to 'include' one file that 'include's everything else - what's to stop the main include file being called again and therefore triggering a redeclare error?
Originally Posted by Frinkky
Your application logic. Most applications these days follow some kind of MVC architecture. And all the major frameworks use a main/front controller (single point of entry) which handles all initialization and includes. There are very, very few exceptions where this kind of architecture does not work.... Any other type of architecture will involve duplicate code and will not be lovely & shiny & object oriented :D