Determine all pairs $(p,m)$ consisting of a prime number $p$ and a positive integer $m$, 
for which $p^3 + m(p + 2) = m^2 + p + 1$ holds.
We start with the given equation:
\[ p^3 + m(p + 2) = m^2 + p + 1 \]

1. **Rearrange the equation:**
   \[ p^3 + mp + 2m = m^2 + p + 1 \]
   \[ p^3 + mp + 2m - m^2 - p - 1 = 0 \]
   \[ p^3 + mp - m^2 + 2m - p - 1 = 0 \]

2. **Group terms involving \( p \):**
   \[ p^3 + mp - p + 2m - m^2 - 1 = 0 \]
   \[ p(p^2 + m - 1) = m^2 - 2m + 1 \]
   \[ p(p^2 + m - 1) = (m - 1)^2 \]

3. **Factor the right-hand side:**
   \[ p(p^2 + m - 1) = (m - 1)^2 \]

4. **Consider the prime factorization:**
   Since \( p \) is a prime number, \( p \) must divide \( (m - 1)^2 \). Therefore, \( p \) must divide \( m - 1 \).

5. **Let \( m - 1 = kp \) for some integer \( k \):**
   \[ m = kp + 1 \]

6. **Substitute \( m = kp + 1 \) into the equation:**
   \[ p(p^2 + kp + 1 - 1) = (kp)^2 \]
   \[ p(p^2 + kp) = k^2p^2 \]
   \[ p^3 + p^2k = k^2p^2 \]

7. **Divide both sides by \( p^2 \):**
   \[ p + k = k^2 \]
   \[ k^2 - k - p = 0 \]

8. **Solve the quadratic equation for \( k \):**
   \[ k = \frac{1 \pm \sqrt{1 + 4p}}{2} \]

9. **Check for integer solutions:**
   For \( k \) to be an integer, \( 1 + 4p \) must be a perfect square. Let \( 1 + 4p = n^2 \) for some integer \( n \):
   \[ 4p = n^2 - 1 \]
   \[ p = \frac{n^2 - 1}{4} \]

10. **Since \( p \) is a prime number, \( n^2 - 1 \) must be divisible by 4:**
    \[ n^2 - 1 = (n - 1)(n + 1) \]
    Both \( n - 1 \) and \( n + 1 \) must be even, so \( n \) must be odd.

11. **Check small values of \( n \):**
    - For \( n = 3 \):
      \[ p = \frac{3^2 - 1}{4} = \frac{9 - 1}{4} = 2 \]
      \[ k = \frac{1 \pm \sqrt{1 + 4 \cdot 2}}{2} = \frac{1 \pm \sqrt{9}}{2} = \frac{1 \pm 3}{2} \]
      \[ k = 2 \text{ or } -1 \]

    - For \( k = 2 \):
      \[ m = kp + 1 = 2 \cdot 2 + 1 = 5 \]

12. **Verify the solution:**
    \[ p = 2, m = 5 \]
    \[ p^3 + m(p + 2) = 2^3 + 5(2 + 2) = 8 + 5 \cdot 4 = 8 + 20 = 28 \]
    \[ m^2 + p + 1 = 5^2 + 2 + 1 = 25 + 2 + 1 = 28 \]
    The equation holds true.

Therefore, the only solution is \( (p, m) = (2, 5) \).

The final answer is \(\boxed{(2, 5)}\).