We provide general sufficient conditions for the efficient classical simulation of quantum-optics experiments that involve inputting states to a quantum process and making measurements at the output. The first condition is based on the negativity of phase-space quasiprobability distributions (PQDs) of the output state of the process and the output measurements; the second one is based on the negativity of PQDs of the input states, the output measurements, and the transition function associated with the process. We show that these conditions provide useful practical tools for investigating the effects of imperfections in implementations of boson sampling. In particular, we apply our formalism to boson-sampling experiments that use single-photon or spontaneous-parametric-down-conversion sources and on-off photodetectors. Considering simple models for loss and noise, we show that above some threshold for the probability of random counts in the photodetectors, these boson-sampling experiments are classically simulatable. We identify mode mismatching as the major source of error contributing to random counts and suggest that this is the chief challenge for implementations of boson sampling of interesting size.