views:

43

answers:

1

Hello,

I am using php/mysql on linux servers. I want to create a user sub domain for each user upon sign up. For instance, john doe --> johndoe.example.com

The issue is, we are going to allow customizations such as adding custom features for clients wanting customizations. So, is it better we automate the process or manually create sub domains for clients requiring customizations and let other users just use basic login?

And how can i automate the process if need be?

+2  A: 

Instead of creating subdomains, have a wildcard subdomain which is mapped into one folder and with PHP figure out which user's data you want to show.

If you are using a cPanel hosting, creating a wildcard subdomain should be pretty easy and wont require any manual adjustment to the httpd.conf file. Otherwise whenever you will add individual subdomains Apache will be restarted in the background, which is not at all good.

I rephrased my answer for clearer understanding.

Sabeen Malik
Is that a good way to go if i want to allow individual user accounts to ask for customizations? Like, I want to be able to go into their account like a developer of a website would to go in and make changes.
AAA
If the subdomain sites are actual sites with their own individual content, even in that case this can help you. Will you be coping over data and creating new folders on the fly too when a new user signs up? You can probably just point the wildcard subdomain to /home/someone/public_html/subdomains and inside that folder create folders for new users and with the help of mod rewrite direct the requests to the appropriate folder. So user1 will have a folder /home/someone/public_html/subdomains/user1
Sabeen Malik
-1: Apache supports wildcard subdomains via `ServerAlias` without the need to restart Apache. cPanel uses that feature (cPanel is powered by Apache).
Andrew Moore
@Andrew . i m not sure why the down vote, i just said that if you use a wildcard subdomain you wont need to restart Apache at all. Secondly adding anything to the server config programmatically would be tough, so just create one wildcard subdomain and do the rest from one fixed directory with php or htaccess
Sabeen Malik
@sabeen I would say 80-90% of the features will be shared. 10% will be client customizations.
AAA
So i guess just keep a copy of the master code somewhere and whenever you create a new user, just create a new user directory and copy over all the files into the new directory, that should get you going.
Sabeen Malik
Pls see the homepage of tumblr.com and see their url field in the sign up form, something like that is what i am looking for: http://www.tumblr.com/
AAA
I know what you are looking for and that is exactly what i am proposing a solution for :)
Sabeen Malik
OK thanks Sabeen.
AAA
You are welcome :)
Sabeen Malik
@Sabeen Malik: Your original answer stated wrongfully that you could not have a wildcard domain with Apache. This is why I had given a negative vote. You CAN configure Apache to redirect all requests from a set of subdomains (wildcarded or not) via `ServerAlias`.
Andrew Moore
@Andrew , i realized after reading my answer for a cpl of times that my use of the "otherwise" could have created a completely different meaning than what i intended , just getting really late here. Thanks for pointing out the confusion and also commenting after a down vote, instead of just a down vote :)
Sabeen Malik