You have the bracketing wrong. You want to trigger the triac after you break from the while loop on a zero crossing, not while you are waiting for the zeroCrossingFlag to be true.
Can you show a circuit diagram, and the Triac data sheet (link)?
Eventually you have to revert the polarity, i.e. start at the raising edge instead of the falling zero crossing edge.
The circuit looks good to me. The data sheet is for a thyristor, but the diagram reveals an opto triac that will work regardless of polarity.
I suggest that you test the code on another board, so that defective components can be excluded. If you have a scope at hand, check the signals. If not - too bad
the code that works in another project on the same PCB.
Certainly suggests a hardware problem.
If you have a scope at hand, check the signals. If not - too bad
If you can flash an led (as well as turn on the triac) in the code following the exit from the while loop() you can determine if you are getting the zero cross interrupt.