Completed PHP port ready for debug