tags:

views:

92

answers:

2

I'm extremely new to CakePHP. From what I've gathered, it seems like I can have multiple applications that all share the same app and cake directories.

So, let's say I have two applications. CakeFacebookApp and GenericCakeBlog. These applications are completely separate from each other and will have completely separate URLs, but they will reside on the same webhost. Should they both be within the same cake structure, or should they each have a full cake install in separate directories?

Technically, I'm sure it will work either way, but I guess I'm looking for a best practice approach. Thanks.

+6  A: 

If your two applications are really distinct, chances are :

  • one day, you might update the version of CakePHP for one -- and not necessarily want to do the same for the other one (or not at the exact same time)
  • if you start getting a lot of users, you might want to put each application on a distinct server

In any of those two situations, having two distinct versions of the framework could help :-)


A couple of things that could be "bad" with using two separate versions :

  • Will take a couple of MB on disk -- well, considering the size of the disks we have now, is this really important ?
  • If you're using an opcode cache like APC, it means you'll have two copies of the same files cached in RAM ; but same note about a couple of MB versus the amount of RAM we have on our servers.


I would, personnally (especially with only two applications ; might be different with 10), use two distinct copies of the framework, in this situation ; the most important reason would be it's easier to update one application's version without any risk of impact on the other.

Pascal MARTIN
Cool. Thanks. That's a very good point that I didn't even consider, and that's the exact kind of answer I was looking for. =)
HenryAdamsJr
Well, glad I could help :-)
Pascal MARTIN
A: 

I think it is a good idea to share the same cake directory but it would be a good idea to keep the app directory separate between the two applications. Have a look at the advanced installation from the documentation: http://book.cakephp.org/view/35/Advanced-Installation

If the two applications share some of the same behaviors, components, etc. it might be a good idea to create a cakephp plugin, as it doesn't take much extra effort to do so.

http://book.cakephp.org/view/115/Creating-a-Plugin

jimiyash