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

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -