Environment-induced entanglement with a single photon