Saturday, August 31, 2013

Advanced CakePHP 2.x installation tutorial

In some situation you might want to develop many application CakePHP with share the same  Cake Libraries on your server filesystem.

In this tutorial I will try to show how to put your Cake libraries in shared location and share them with your apps in Linux or Windows.

1. Download the latest CakePHP 2.x, unzip it upload to share location.
In my tutorial I will be replacing the Cake libraries in
 
Linux:
/usr/share/cakephp2

Windows:
C:/cakephp2


2. Upload the APP folder and its content to your www/homepage root. You do not need to upload anything else.

3. Edit /app/webroot/index.php

Find:
define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
 
Replace with:
 
#Linux 
define('CAKE_CORE_INCLUDE_PATH', DS.'usr'.DS.'share'.DS.'cakephp2'.DS.'lib');
 
#Windows
define('CAKE_CORE_INCLUDE_PATH','C:'.DS.'cakephp2'.DS.'lib');
 

And in all your other apps on the same server, edit the /app/webroot/index.php file and do the same. Rename app folder to your own project name.  Your CakePHP libraries are now shared, and can be utilized from all apps.

1 comment: