Maybe?

Sirab, I had no time to read ALL the comments in this post, so I do not know if this was already suggested to you or not, or if you are doing this..

One common error with running PHP files in a local machine is that people open the file incorrectly in the browser.

try this:

http://localhost/~yourcomputerus ername/thedirectory/yourphpfile.php