The only such pair is (p,q)=(37,11).
We have p(p−1)=(q+1)(q2−q+1). Since p is prime and p>p−1 and q2−q+1>q+1, there exists an integer m>0 such that
q2−q+1=mp,(1)
p−1=m(q+1).(2)
Since q3=p2−p+1>(p−1)2=m2(q+1)2>m2q2 we deduce that q>m2. We have from (1) and (2) that
mp≡1(modq)p≡m+1(modq)
and so we obtain that m2+m−1 is divisible by q.
Since m2+m−1<2m2<2q this means that
q=m2+m−1.(3)
Applying the substitution from (3) to (1) and (2), we obtain
q2−q+1=mp=m2(q+1)+m=(q−m+1)(q+1)+m
which after cancellations gives (m−3)q=0 and therefore m=3. Replacing in (3) and then in (2) we obtain (p,q)=(37,11), the only solution.