Storing MySQL passwords and similar

What sorts of methods do people use to store information such as database passwords, which my PHP scripts will need access to, but should never be accessible from outside?

I’ve tried having a non-web accessible folder, which apache can still access before, but can’t remember having much luck.