require once - PHP - require_once seems to be including files multiple times and causing errors -
in php app, have several calls require_once
. on development pc works fine , doesn't try include same file multiple times. when moved production server i'm getting error
cannot redeclare class myclass
after searching through code i've found happens after call require_once
, must causing it.
i've searched through entire project , class declared in 1 file, , it's ever included through require_once
. there weird php config make require_once
behave differently on production server?
thanks
put following @ top of included class file:
if( class_exists( "<yourclassname>")) { throw new exception("class defined"); }
you receive clear error message class re-called.
Comments
Post a Comment