Create subdomains programatically?

Hi, I’m setting up a feature on my site that allows users to register themselves. I was thinking of creating a subdomain for each new user (there won’t be that many) automatically during the registration process. I program mainly in PHP. Is there a way to create subdomains other than using the control panel? I would like this to be automated if possible.

My other idea was to create a new directory for each user, so they would have an area at created automatically during registration. I can do that easily, but my client wants to have a subdomain created if possible. Even if subdomains can be created from within a PHP script, will the user have to wait some amount of time before the subdomain is reachable?

Thanks for any insight!

Dreamhost does not offer this out of the box. You /can/ ask them to set up a wildcard vhost for you, but whether they do or not is up to them – and they’ll want an explanation of why it’s necessary (and basically an assurance that you know what you are doing).

Yeah, I had them do this for a WordPress Mu installation I had running for a while.

Free unique IP and $67 off with promo code [color=#CC0000]FLENSFREEIP67[/color] or use [color=#CC0000]FLENS97[/color] for $97 off. Click here for more options

Stick with a directory for each person.

In PHP the function is the same as the Linux command mkdir.
You can get all the details on that function here