Fixed compilation, when compiling right into PHP (Ilia Alshanetsky)
Fixed build in a separate directory (Ilia Alshanetsky)