various fixes in php

repaired various errors in php