How long it takes to "master" a language depends on many factors. Really, there is no short answer to that question. You can be very good at a programming language and still have a lot to learn, so how you define mastery also comes into play.
I don't consider myself a master, but I do quite a bit of PHP, CSS, and HTML programming, and I learned just by doing more than anything else. I'm not the kind of guy with a lot of spare cash sitting around, so paying for an $80 textbook isn't an option. I've heard codeacademy.com is a really great resource for beginning programmers, and many have had a lot of success with it. If you already have some programming experience, I'd recommend just diving straight in and using a reference as a guide. I personally used w3schools' reference material to help me learn PHP, and within a day I knew the basics of the language.
In any case, whether you choose to follow tutorials, buy a large manual for the programming language, or simply use online reference material, the best way to learn is just to program. You'll be surprised at how fast you learn when you give yourself the confidence to take on big projects.