Generally phalanx is much better on flat areas - in noth macedonia there is hardly any flat area :)
We can't forget that greek phalanx wasn't so bad comparing with macedonian one. Macedonian phalanxmen didn't have shields and good armour (comparing with Greeks). So when Romans came and started throwing pilums, it generally worked :). Anyway I think javelins are best option on every phalanx - they force opponents to attack ;)