added PHP client, server refactoring