Catalyzes the formation of pyridoxal 5'-phosphate from ribose 5-phosphate (RBP), glyceraldehyde 3-phosphate (G3P) and ammonia. The ammonia is provided by PDX2. Can also use ribulose 5-phosphate and dihydroxyacetone phosphate as substrates, resulting from enzyme-catalyzed isomerization of RBP and G3P, respectively. Also plays an indirect role in resistance to singlet oxygen-generating photosensitizers. aldehydo-D-ribose 5-phosphate + D-glyceraldehyde 3-phosphate + L-glutamine = H(+) + 3 H2O + L-glutamate + phosphate + pyridoxal 5'-phosphate Cofactor biosynthesis; pyridoxal 5'-phosphate biosynthesis. Defects cause some indirect sensitivity to photosensitizers, due to the inability to synthesize pyridoxal 5'-phosphate. Indeed, pyridoxal 5'-phosphate is destroyed in the presence of photosensitizers, and cannot be synthesized in reaction. Belongs to the PdxS/SNZ family.