Share Your CakePHP Core and Application Files Server Wide

If you are deploying several Cake applications server wide you may want to keep the Cake core in one central place so that it can be easily updated.  In order to do this place the cake core directory somewhere on your server where is can be accessed.  For example /usr/lib/php/cake.  Then, when you create your applications open up your root index file  and replace the following:
if (!defined('CAKE_CORE_INCLUDE_PATH')) {

with this:
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
DS . 'usr' . DS . 'lib' . DS . 'php' . DS . 'cake');

You are now using the common cake core. When a new update comes out to the library, just replace the files in /usr/lib/php/cake with the new version!
If you want to go a step further and share some of your own models, views, controllers, behaviors, helpers, or components between applications you can use a similar technique.  For example create a folder in ‘/usr/lib/php/models’ and put all your common models in that folder, then in your application open up bootstrap.php and add the following:
$modelPaths = array(
DS . 'usr' . DS . 'lib' . DS . 'php' . DS . 'models'

Like I said the same thing can be done with views, controllers, helpers, behaviors or components.  The cookbook says how!  This is pretty handy for when you find a bug in a model and you have several applications using that model!