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. By stress treatment with salicylic acid and ethephon. Vitamin B6 is an essential quencher of singlet oxygen in plants, that can protect cellular membranes from lipid peroxidation. Belongs to the PdxS/SNZ family.