Synthetic photonic materials are an emerging platform for exploring the interface between microscopic quantum dynamics and macroscopic material properties1,2,3,4,5. Photons experiencing a Lorentz force develop handedness, providing opportunities to study quantum Hall physics and topological quantum science6,7,8. Here we present an experimental realization of a magnetic field for continuum photons. We trap optical photons in a multimode ring resonator to make a two-dimensional gas of massive bosons, and then employ a non-planar geometry to induce an image rotation on each round-trip9. This results in photonic Coriolis/Lorentz and centrifugal forces and so realizes the Fock–Darwin Hamiltonian for photons in a magnetic field and harmonic trap10. Using spatial- and energy-resolved spectroscopy, we track the resulting photonic eigenstates as radial trapping is reduced, finally observing a photonic Landau level at degeneracy. To circumvent the challenge of trap instability at the centrifugal limit10,11, we constrain the photons to move on a cone. Spectroscopic probes demonstrate flat space (zero curvature) away from the cone tip. At the cone tip, we observe that spatial curvature increases the local density of states, and we measure fractional state number excess consistent with the Wen–Zee theory, providing an experimental test of this theory of electrons in both a magnetic field and curved space12,13,14,15. This work opens the door to exploration of the interplay of geometry and topology, and in conjunction with Rydberg electromagnetically induced transparency, enables studies of photonic fractional quantum Hall fluids16,17and direct detection of anyons18,19.