Production of phosphate compounds from materials containing phosphorus and at least one of iron and aluminium