Photons naturally solve the BosonSampling problem: sample the outputs of a multi-photon experiment in a linear-optical interferometer. This is strongly believed to be hard to do on a classical computer, and motivates the development of technologies that enable precise control of multi-photon interference in large interferometers. Here we report multi-photon experiments in a 5-mode integrated interferometer. We use novel three-dimensional manufacturing techniques to achieve simultaneous control of 25 independent parameters that describe an arbitrary interferometer. We characterize the chip using one- and two-photon experiments, and confirm the quantum mechanical predictions for three-photon interference. Scaled up versions of this setup are the most promising way to demonstrate the computational capability of quantum systems, and may have applications in high-precision measurements and quantum communication.