The realization that electron localization in disordered systems (Anderson localization) is ultimately a wave phenomenon has led to the suggestion that photons could be similarly localized by disorder. This conjecture attracted wide interest because the differences between photons and electrons--in their interactions, spin statistics, and methods of injection and detection--may open a new realm of optical and microwave phenomena, and allow a detailed study of the Anderson localization transition undisturbed by the Coulomb interaction. To date, claims of three-dimensional photon localization have been based on observations of the exponential decay of the electromagnetic wave as it propagates through the disordered medium. But these reports have come under close scrutiny because of the possibility that the decay observed may be due to residual absorption, and because absorption itself may suppress localization. Here we show that the extent of photon localization can be determined by a different approach--measurement of the relative size of fluctuations of certain transmission quantities. The variance of relative fluctuations accurately reflects the extent of localization, even in the presence of absorption. Using this approach, we demonstrate photon localization in both weakly and strongly scattering quasi-one-dimensional dielectric samples and in periodic metallic wire meshes containing metallic scatterers, while ruling it out in three-dimensional mixtures of aluminium spheres.