Giants rally, edge out Phillies 6-5