migrating to php: work in progress