Create subdomains programatically?

Create subdomains programatically?

Posted by: jumpyg
Posted on: 2007-07-03 08:21:00

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 www.example.com/newusername 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!

Re: Create subdomains programatically?

Posted by: eike
Posted on: 2007-07-03 08:40:00

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).

Re: Create subdomains programatically?

Posted by: Lensman
Posted on: 2007-07-03 12:53:00

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

Re: Create subdomains programatically?

Posted by: username
Posted on: 2007-07-06 18:45:00

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

Tags: subdomainssubdomainphp scriptamount of timeinsightcontrol panel