i know almost anything about sub-domains and dns records. i have heard about them and i know just the basics.
Actually, on my server, i do create the subdomain under plesk and then contact my hosting to create the right dns. and in 1-2 days the subdomain is reachable from everywhere (plesk can manage dns automatically, i know, but becose i dont know how does dns exactly works, i prefer to let my hoster handle them)
But.. when you do register on wordpress.com, posterous.com, etc, they create a subdomain like http://yourname.service_name.com that is ready in few seconds.. how?
I know this could be an question hardly to response because my ignorance i dont know how to formulate the question better -.-
Oh, if it can help, my environment must be linux (debian actually)
Most people achieve this by using a Wildcard DNS Record, this gives the appearence of creating subdomains instantly.
Once you've got a wildcard DNS setup like this:
*.example.com A 188.8.131.52
You need to tell Apache you want all sub domains to be caught by a virtual host, you can do this with ServerAlias:
In PHP you can then look at $_SERVER["SERVER_NAME"] to figure out what subdomain has been used to access the virtual host, you can then have subdomain specific code/content.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki