Changing research disciplines during Graduate school
It's certainly possible, at least in the universities I'm acquainted with, to apply to a Ph.D. program in a field different from your masters degree. But to be accepted into such a program, you'll have to convince an admissions committee (or the professor with whom you want to work) that you have the necessary background. You mentioned that you have relevant background but not formal training, so this may present a problem. If you can take some relevant courses while you're in the masters program, or if you can get recommendation letters attesting to your background knowledge, that would help. If that's not possible, then you may need to take some classes after you get your masters degree and before you apply to Ph.D. programs.