tweaked phpserver function