These were problems with php 5.5 on Windows Server 2012 R2.
They were OK in php 5.4 on Server 2003 R2.
Blank line above "<?php" prevents service from starting.
Using "echo" anywhere seems to cause the service to be terminated. Debug using a log file instead.
$logfile = 'c:\\temp\\mylog.log';
$log = fopen($logfile, 'a');
$logentry = "Stuff.\r\n";