Page 1 of 1
create subdomain with php
Posted: Sat Apr 02, 2005 8:41 pm
by hongco
hi,
Do you know if we can create subdomain with php.
A user will register for a subdomain, and this script will create it on the fly.
I understand we need to have access to root.
Thanks!
Posted: Sat Apr 02, 2005 9:01 pm
by feyd
That's a DNS change. It should be possible, though.
Posted: Mon Apr 04, 2005 1:32 am
by hongco
Thanks,
I will do some research on this part.
Posted: Mon Apr 04, 2005 2:37 am
by Termina
Hello
If you use zoneedit.com (which I do! and suggest you do), you can create subdomains with a simple command:
lynx -source -auth=username:password '
http://dynamic.zoneedit.com/auth/dynami ... domain.com'
or
wget -O - --http-user=username --http-passwd=password '
http://dynamic.zoneedit.com/auth/dynami ... domain.com'
Replace www with the subdomain. This must be done on a computer with the IP you want.
Posted: Mon Apr 04, 2005 10:52 am
by Fusioned
Correct me if I'm wrong, but isn't a subdomain just another folder in a directory? IE:
php.mywebsite.com is the same as
http://www.mywebsite.com/php/
Therefore, you could just create a script that would create a new directory and set the proper permissions. I already did it but PHP safe mode is on so I cant take advantage of it..

Posted: Mon Apr 04, 2005 10:55 am
by feyd
to a point, yes they are just a subdirectory. However, not all subdirectories are automatically subdomains. It still requires a DNS change to take effect.
Posted: Mon Apr 04, 2005 11:53 am
by timvw
the easiest (and recommended way to go) is to write a (wrapper)script that uses nsupdate if you have bind as nameserver...