5. Given a point $P$ in a plane, the distances from $P$ to the three sides of an equilateral $\triangle ABC$ on the lines $l_{1}, l_{2}, l_{3}$ are $6, 9, 12$ respectively. The number of possible values for the side length of $\triangle ABC$ is ( ).
(A) 1
(B) 2
(C) 3
(D) 4
5.D.

Let the height of the equilateral $\triangle ABC$ be $h$, and the distances from point $P$ to the three sides of $\triangle ABC$ be $h_{1}, h_{2}, h_{3}$.

As shown in Figure 5, when $P \in \mathrm{I}$, $h=h_{1}+h_{2}+h_{3}=27$; when
$P \in$ II, $h=h_{1}+h_{2}-$
$h_{3}$, there are 3 possible values; when $P$
$\in$ III, $h=h_{1}-h_{2}-h_{3}$
$<0$, no possible values.
Therefore, there are 4 different side lengths for such $\triangle ABC$.