Cannot redeclare class require_once


I’m using classes and making each class a file. when I’m including dependet classess, I use require_once to avoid multiple declarations – yet I get a Fatal error: Cannot redeclare class…



Make sure all files that require the class have require_once and also make sure that the path that is required is the same case in all situations.  For example, my problem was that I was including a “/Users/name/xxx.php” and “/users/name/xxx.php”.  These paths are different and so PHP includes both of these.


keywords: Cannot redeclare class require_once


Tagged with: ,

Leave a Reply