Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Will this weird application model work?

12:07 am on Jul 13, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 6, 2006
votes: 0

I'm getting started on a rather atypical PHP application. Tell me if this description sounds like a good idea or not:

Hundreds of domain names will be configured on a shared host to use the same document root directory. The PHP application files will look up a record in the database according to the domain name being requested. It's like name-based virtual hosting. Then according to that domain's configuration in our database, the right template files and data will be displayed.

Can any older, wiser developer reveal any unforeseen problems with this model?

Another thing, and maybe this should be a separate thread, but should I use a framework like CakePHP? Would such a framework play nicely with the sort of application I described above where the same code is used to generate vastly different websites? CakePHP or CodeIgniter are tempting because it sounds like they would rapidly speed up development, but maybe they have better application in another website. Also, CakePHP seems really slow. It takes like a quarter to half second just to produce a simple hello world kind of page with the default CakePHP configuration on my shared server.

Thanks for your advice,

1:17 am on July 13, 2007 (gmt 0)

Preferred Member

10+ Year Member

joined:July 16, 2001
votes: 0

Consider these:

A) All sites are text/html with little to no unique php page building magic.

B) More than one site will require specially crafted templates or unique php page building magic to render.

If your sites are strongly type A, your idea is feasible.

If your sites are more strongly type B, I would not recommend that you handle them this way.

If most of the sites start out as type A, and only a *very* few grow to type B, then you can still proceed as planned for the type A's, and just get separate accounts for the type B's as needed.

You should consider .htaccess/ModRewrite as an alternative or supplement to your strictly php based solution. You could still keep them all in one account, but sub out the specific ones without having to build a framework for handling different domains in php.

2:46 am on July 13, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 6, 2006
votes: 0

Thank you for responding and for your suggestions. As most of the sites will use just three or four templates and plug in different data from MySQL, I'm thinking the "name-based virtual website" thing will be a viable solution.

Other thoughts and suggestions are still welcome.


3:01 pm on July 13, 2007 (gmt 0)


WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
votes: 2

I think sharing the same DOCUMENT_ROOT is going to cause issues in the future for you. Apache's Virtual Host setup is ideal for what you want to do. If you need to share common documents/templates/scripts in each site, then using a common repository and place that in the include path for each virtual site.

I think having a separate database for each site may also be a wise idea, but that is up to you and your design plans.


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members