Answer: $p=\frac{14}{3}, x=-5$.
4. From the first equation, we find:

$$
P=-\frac{x^{2}-x-2}{x-1}=-x+\frac{2}{x-1}, x \neq 1
$$

From the second equation, we find: $p=-\frac{x^{2}+2 x-1}{x+2}=-x+\frac{1}{x+2}, x \neq-2$.

Then, if $x$ is a common root corresponding to the parameter $p$, we have

$$
-x+\frac{2}{x-1}=-x+\frac{1}{x+2}
$$

From which we find $x=-5$ and $p=\frac{14}{3}$.