Josephson junctions are the basis for the most sensitive magnetic flux detectors, the definition of the unit volt by the Josephson voltage standard, and superconducting digital and quantum computing. Since the physics of Josephson junctions relies solely on the existence of two coupled coherent quantum states, its predictions are highly universal and can be observed in systems as diverse as coupled superconductors, superfluids, atomic Bose-Einstein condensates, and exciton polariton condensates. Josephson junctions are characterised by an intrinsic phase jump between the coupled coherences. Controlling this phase jump is fundamental for applications in computing. Here, we experimentally demonstrate controllable phase relations between two photon Bose-Einstein condensates. The investigated device realises an optical analogue of a 0,\(\pi\)-Josephson junction, which can act as a building block for an ultrafast spin glass simulator driven by Bose-Einstein condensation. Such a simulator will reduce annealing times in analog spin glass simulation by many orders of magnitude.