Install the latest Cakephp on Ubuntu Server 12.04 LTS

Next Framework that i want to introduce to you is ” Cakephp the rapid development php framework “. I have successfully install cakephp 2.2.2 with the latest cake console in this server. I hope this can help you to make a few cakephp application via this environment.

Before I go on, I found that there is no new tutorial on how to install the latest core on cakephp on this kernel because if you do “sudo apt-get install cakephp” it only will install the latest version available on the kernel and not the latest – latest version of cakephp. So with this techtorial i can show you on how to install the latest cakephp core within the server and hopefully i will give you a rough idea on how to install cakephp core on other kernel.

Let the Techtorial begin:

1.  First we need to see what the latest version of cakephp available. To do that we can just check it on cakephp github. It is where the put the core to easy download and check what version available.

Cakephp Core Version

2.  After you have check the version, now we can start to install the script. Before that run the update and upgrade to ensure that our server are up-to-date.

sudo apt-get update

sudo apt-get upgrade

3.  Now install apache2, mysql-server and php5

sudo apt-get install apache2 mysql-server php5

4.  Next we can need to enable rewrite module on our server.

sudo a2enmod php5 rewrite

5.  After rewrite module been enabled. We need to install cakephp version first before we can change it to the latest version. The reason we do this first to get what the directory that the cakephp core been install then we can just remove it.

sudo apt-get install cakephp

6.  We proceed to php folder on /usr/share/ this is the default folder when the server install the core.

cd /usr/share/php

After we are on the directory just dir it to find what folder that cakephp make so that we can remove it.

sudo rm -R cake

7.  This where we can change the version of our cakephp and also the compression app either choose the zip or tar.gz. Choose only one method on how to decompress it.

a.  Method 1 – Zip compression ( Change the 2.2.2 to the latest version or the version that you want. )

sudo wget

sudo apt-get install unzip

sudo unzip 2.2.2

sudo mv cakephp-cakephp-ac41b42 cakephp

sudo rm -R 2.2.2

b.  Method 2 – Tar.gz compression

sudo wget

sudo tar -xzf 2.2.2

sudo mv cakephp-cakephp-ac41b42 cakephp

sudo rm -R 2.2.2

8.  Now we will remove the script that been install together with v1.3.7.1 to do that we need to go to this directory

cd /usr/bin

This is where the script been install, we need to replace it with a new script so that when we type in cake command we will get the latest script. To do that we need to remove the script first and then link with a new one.

sudo rm -R cake

9.  In the same directory we need to link the script in the core with this directory – /usr/bin/

sudo ln -s /usr/share/php/cakephp/lib/Cake/Console/cake

To check we install the correct script for our cake just type in cake on our console. It will give you this.

Now we have install all the necessary thing to bake our cake app. Next I will show you where the correct directory we need to cake bake our app.

We have install the lamp on our server it will give us this directory to work on /var/www/ . This is where we will bake our app or do other html/php stuff. Before that we need to own it first so that when we work with the file on WinSCP or Aptana Studio, it doesn’t prompt any issue regarding to only root can access to it. To change the folder from root to user we need to do something toward the folder itself.

sudo chown -R <username> <foldername>


sudo chown -R <username>:<username> <foldername>

sudo chmod -R 0775 var

cd /var/www

That how you change the permission on a folder/directory in linux. Sometimes the server can’t access the cake app folder because of it need to write in tmp folder. Just do the same then cake can write it temp folder.

So, Happy Baking some Cake