I didn't vote to close, as in my opinion this is a borderline question.  I think the reasoning for "Off-Topic" is that this is a little beyond the scope of Super User and more into the realms of either Stack Overflow or Server Fault depending on what you're looking for. 

However, upon further looking into your question I see that you're really not asking a question here.  You're simply stating "Something weird here" and then post A LOT of information that can be overwhelming.  When asking question on *any* SE site I suggest first trying to figure out "What's my main issue that I'm having, and how can I clearly state that issue?".  When you've taken the time to really think about the issue at hand, then you're able to ask informative, good questions.

For example, instead of stating "Something weird is happening with X" try doing a little research to come up with a question that states along the line of "X is not doing Y action under Z conditions".  

Finally I would also suggest looking into the formatting of your post.  Just as too little information is frustrating to those that answer, so too is too much information.  Try posting only relevant information.

*Note: I know NOTHING about PHP and therefore you may have posted all that was necessary for this situations.  However what I say does go in general*