Showing interest / Applying for Phd position that has just opened, before finishing Master studies
If you are currently working on a master's thesis in the group of the professor with whom you'd like to a do a PhD, the best thing to do is set up an appointment and talk to him.

As an advisor, I don't need to have a published paper to see whether someone in my own group is a competent researcher or not. I can see this by interacting with the person, through reading their project updates and emails, and by talking with other the more senior members of the research group (who sometimes will work with the students more closely than I can). 

Given that the goal of an advisor is to select people they believe will become excellent researchers rather than simply the "top students," someone who is an "internal" candidate is often a better option than taking a chance on someone whose work the faculty member hasn't been able to observe directly.

[That said, however, I think there is also something to be said for considering going somewhere else for a PhD than the place where you did your bachelor's and master's degrees, when it makes sense to do so.]