Set the compass smaller than PB
Put the point of the compass at P and mark two arcs on the line on opposite sides of P
Mark the compass slightly bigger in radius
Use each the the two new points on the line to draw intersecting arcs encompassing P
Call the intersections of the latest arcs C and D
Use the ruler to draw a line through C and D
This line will be perpendicular to AB and passing through P