TITLE: When are there enough projective sheaves on a space X?
QUESTION [46 upvotes]: This question is being asked on behalf of a colleague of mine.
Let $X$ be a topological space.  It is well known that the abelian category of sheaves on $X$ has enough injectives: that is, every sheaf can be monomorphically mapped to an injective sheaf.  The proof is similarly well known: one uses the concept of "generators" of an abelian category.
It is also a standard remark in texts on the subject that on a general topological space $X$, the category of sheaves need not have enough projectives: there may exist sheaves which cannot be epimorphically mapped to by a projective sheaf. (Dangerous bend: this means projective in the categorical sense, not a locally free sheaf of modules.)  For instance, Wikipedia remarks that projective space with Zariski topology does not have enough projectives, but that on any spectral space, a space homeomorphic to $\operatorname{Spec}R$, there are enough projective sheaves.
Two questions:

Who knows an actual proof that there are not enough projectives on, say, $\boldsymbol{P}^1$ over the complex numbers with the Zariski topology?  What about the analytic topology, i.e. $\boldsymbol{S}^2$?
Is there a known necessary and sufficient condition on a topological space $X$ for there to be enough projectives?  


EDIT: I meant the question to be purely for sheaves of abelian groups.  Eric Wofsey points out that the results alluded to above on Wikipedia are not consistent when interpreted in this way, since $\boldsymbol{A}^1$ and $\boldsymbol{P}^1$, over an algebraically closed field $k$, with the Zariski topology are homeomorphic spaces: both have the cofinite topology.
I am pretty sure that when my colleague asked the question, he meant it in the topological category, so I won't try to change that. But the other case is interesting too. What if $(X,\mathcal{O}_X)$ is a locally ringed space. Does the abelian category of sheaves of $\mathcal{O}_X$-modules have enough projectives? I think my earlier warning still applies. Since for a scheme $X$ not every $\mathcal{O}_X$-module is coherent, it is not clear that "projective sheaves" means "locally free sheaves" here, even if we made finiteness and Noetherianity assumptions to get locally free and projective to coincide.

REPLY [7 votes]: I just saw this question now.
If $X$ is a Hausdorff space with a basis of compact open sets, then the category of sheaves of abelian groups on $X$ has enough projectives.  Let $R$ be the ring of locally constant functions $f\colon X\to \mathbb Z$ with compact support and pointwise operations.  $R$ is a unital ring iff $X$ is compact, but it is always a ring with local units (i.e., a directed union of unital subrings).  An $R$-module $M$ is unitary if $RM=M$.  This is equivalent to for all $m\in M$, there is an idempotent $e\in R$ with $em=m$.  It follows that the category of unitary $R$-modules has enough projectives (the direct sums of modules of the form $Re$ with $R$ idempotent do the job).
It is known that the category of sheaves of abelian groups on $X$ is equivalent to the category of unitary $R$-modules.  The equivalence takes a sheaf to its global sections with compact support. Thus the category of sheaves of abelian groups on $X$ has enough projectives.
I don't know a precise reference for this folklore. The compact totally disconnected case is easily deduced from Pierce's Memoir of the AMS on modules over commutative regular rings. The modification for the locally compact case is known to those studying representations of reductive groups over local fields.