How many years is it to become a doctor?

Depends on what kind of doctor.

MD, medical doctor.

JD, Judicary doctor

PhD, doctor of philosphy

ED, doctor of engineering

theres more...

For PhD in engineering and probably many other areas a PhD takes usually 4-5 years after your bachelors. Usually you are not required to get your masters before your PhD. I have seen some complete their PhD in 2.5 yrs and some take forever... like 8 yrs lol. its up to you how long it will take to finish.