PHP_SAPI check to actual code (below class definitions, and add some comments