ASelect Type tool» Mouseover the shape or path and start writing when the cursor shape changes to type cursor with a curved line on it.
BSelect Type tool» Choose the Wrap text option from the Options bar and choose the shape you want to give the text.
CType the required text and transform it with the help of different transform tools to adjust it according to the shape.
DIt is not possible to achieve this effect in Photoshop.