Photonics is a promising platform for implementing universal quantum information processing. Its main challenges include precise control of massive circuits of linear optical components and effective implementation of entangling operations on photons. By using large-scale silicon photonic circuits to implement an extension of the linear combination of quantum operators scheme, we realize a fully programmable two-qubit quantum processor, enabling universal two-qubit quantum information processing in optics. The quantum processor is fabricated with mature CMOS-compatible processing and comprises more than 200 photonic components. We programmed the device to implement 98 different two-qubit unitary operations (with an average quantum process fidelity of 93.2 ± 4.5%), a two-qubit quantum approximate optimization algorithm, and efficient simulation of Szegedy directed quantum walks. This fosters further use of the linear-combination architecture with silicon photonics for future photonic quantum processors.