homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Will this weird application model work?

5+ Year Member

Msg#: 3393200 posted 12:07 am on Jul 13, 2007 (gmt 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,



10+ Year Member

Msg#: 3393200 posted 1:17 am on Jul 13, 2007 (gmt 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.


5+ Year Member

Msg#: 3393200 posted 2:46 am on Jul 13, 2007 (gmt 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.



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

Msg#: 3393200 posted 3:01 pm on Jul 13, 2007 (gmt 0)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved