When glucose reacts with phenylhydrazine, it forms an osazone. Glucose, being an aldose sugar, contains both an aldehyde group and a hydroxyl group. The formation of an osazone involves the reaction of glucose with phenylhydrazine at both the aldehyde group and one of the hydroxyl groups. Glucose undergoes a reaction with three molecules of phenylhydrazine to form the corresponding osazone, which is a crystalline compound. This is a characteristic feature of reducing sugars like glucose, which form osazones in the presence of excess phenylhydrazine.
Thus, the value of \( X \) is \( \boxed{3} \).