{"id":806,"date":"2012-06-12T16:16:53","date_gmt":"2012-06-13T02:16:53","guid":{"rendered":"http:\/\/mymonkeydo.com\/?p=806"},"modified":"2012-06-12T16:16:53","modified_gmt":"2012-06-13T02:16:53","slug":"cannot-redeclare-class-require_once","status":"publish","type":"post","link":"https:\/\/mymonkeydo.com\/cannot-redeclare-class-require_once\/","title":{"rendered":"Cannot redeclare class require_once"},"content":{"rendered":"
I’m using classes and making each class a\u00a0file. when I’m including dependet classess, I use require_once to avoid\u00a0multiple declarations – yet I get a\u00a0Fatal error<\/strong>: Cannot redeclare class…<\/p>\n <\/p>\n 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. \u00a0For example, my problem was that I was including a “\/Users\/name\/xxx.php” and “\/users\/name\/xxx.php”. \u00a0These paths are different and so PHP includes both of these.<\/p>\n <\/p>\n keywords:\u00a0Cannot redeclare class require_once <\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[2],"tags":[18,54],"yoast_head":"\nSolution<\/h2>\n
\nsource: http:\/\/bytes.com\/topic\/php\/answers\/461064-require_once-doesnt-work-cannot-redeclare-class<\/p>\n