Separating CakePHP App from Core.

Reading time ~1 minute

Separating CakePHP App from Core.

Why would I do that?
-Easy to upgrade
-Easy to deploy new apps
-App isolation from Core

These steps should be fairly straight forward and easy to follow. The way we set it up puts the core in the root, so this will be good for local installations on mac/linux. You can set it up for a shared environment, but I will leave that for another day.

Note: This is showing CakePHP 2.1.1 but the steps are the same for later versions.

Step 1 - Download core and place files in the proper folders.
Make the initial directories. The first is what we will connect our App’s to. The second will contain the core itself.

mkdir /var/cake
mkdir ~/CoreCode
Now lets download CakePHP from and extract it to our folder. Then lets rename it to something easier to read.

cd ~/CoreCode
wget <a href="" target="_blank"></a><br />
tar -zxvf<br />
mv cakephp-cakephp-0cad237 cakephp-2.1.1
Step 2 - link the core directory to our CakePHP core.

cd /var/cake
ln -sfn ~/CoreCode/cakephp-2.1.1/ cakephp2
Now we can take the app folder from the CakePHP core (in ~/CakeCore/cakephp-2.1.1) and place it in our webroot that will broadcast our applications. This can be in a variety of places. /var/www; /var/webroot; ~/public_html and more depending on the server configuration.

cd ~/CakeCore/cakephp-2.1.1
cp -av App ~/public_html/
Note: at this point the ‘App’ folder doesn’t need to be called ‘App’ it can be named anything, or you can take it’s contents out and place them in which ever directory you desire.

Step 3 - Configure the application to the core
This is clearly the most important step. Change the Keys and connect to the database. This is normal and won’t be covered. What is different is now we will link our App to our Core. Navigate to App/Webroot and open index.php Uncomment the following line:

//define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
and change it to the following:

define('CAKE_CORE_INCLUDE_PATH', DS.'var'.DS.'cake'.DS.'cakephp2'.DS.'lib');
We should be all configured and setup now to connect properly to our core. We can repeat this step as needed. You can also download this awesome start app which includes Twitter Bootstrap (a killer CSS library) and jQuery.

Click here to download the starter app.

Asyncio Basics Python 35

# Asyncio basics in pythonPython 3.5 brought with it asyncio. An event loop based paradigm previously available as a library but now it i...… Continue reading

Quick Laravel/Lumen install with Docker!

Published on March 02, 2016

PHP To Python

Published on February 24, 2016