Let X be a completely regular Hausdorff space and, as usual, let C(X) denote the ring of real-valued continuous functions on X. The lattice of z-ideals of C(X) has been shown by Martínez and Zenk (2005) to be a frame. We show that the spectrum of this lattice is (homeomorphic to) βX precisely when X is a P-space. This we actually show to be true not only in spaces, but in locales as well. Recall that an ideal of a commutative ring is called a d-ideal if whenever two elements have the same annihilator and one of the elements belongs to the ideal, then so does the other. We characterize when the spectrum of the lattice of d-ideals of C(X) is the Stone-Čech compactification of the largest dense sublocale of the locale determined by X. It is precisely when the closure of every open set of X is the closure of some cozero-set of X.