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 1.3.7.1 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 https://github.com/cakephp/cakephp/zipball/2.2.2

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 https://github.com/cakephp/cakephp/tarball/2.2.2

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>

OR

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

Advertisements

11 comments

  1. Nachie · January 19, 2013

    Thank You Very Much to The Techdoctor

  2. Mark Morgan · January 28, 2013

    Hi, thanks for the info, found this really useful.

  3. Pingback: Installing Latest version of Cakephp on Ubuntu | Nerdy Goodness – Mark Morgan's Web Development Blog – php, jquery, css
  4. Kam.paul · February 28, 2013

    Thanks for useful info Rahman! It is really very informative article you have given.

  5. Yoogin · May 9, 2013

    Very useful and complete set of instructions

  6. Pankaj · May 18, 2013

    can you explain me a baking process also

  7. Bartisimos · June 3, 2013

    Thank you very mutch – very good tutorial

  8. vivek raj · July 1, 2013

    while i tried to display the console using command “cake”, i got this error.
    PHP Warning: _cake_core_ cache was unable to write ‘cake_dev_’ to File cache in /usr/share/php/cakephp/lib/Cake/Cache/Cache.php on line 310

    Warning: _cake_core_ cache was unable to write ‘cake_dev_’ to File cache in /usr/share/php/cakephp/lib/Cake/Cache/Cache.php on line 310
    PHP Warning: /usr/share/php/cakephp/lib/Cake/Console/Templates/skel/tmp/cache/persistent/ is not writable in /usr/share/php/cakephp/lib/Cake/Cache/Engine/FileEngine.php on line 337

    Warning: /usr/share/php/cakephp/lib/Cake/Console/Templates/skel/tmp/cache/persistent/ is not writable in /usr/share/php/cakephp/lib/Cake/Cache/Engine/FileEngine.php on line 337
    PHP Fatal error: Uncaught exception ‘CacheException’ with message ‘Cache engine _cake_core_ is not properly configured.’ in /usr/share/php/cakephp/lib/Cake/Cache/Cache.php:166
    Stack trace:
    #0 /usr/share/php/cakephp/lib/Cake/Cache/Cache.php(136): Cache::_buildEngine(‘_cake_core_’)
    #1 /usr/share/php/cakephp/lib/Cake/Console/Templates/skel/Config/core.php(336): Cache::config(‘_cake_core_’, Array)
    #2 /usr/share/php/cakephp/lib/Cake/Console/ShellDispatcher.php(133): include_once(‘/usr/share/php/…’)
    #3 /usr/share/php/cakephp/lib/Cake/Console/ShellDispatcher.php(100): ShellDispatcher->_bootstrap()
    #4 /usr/share/php/cakephp/lib/Cake/Console/ShellDispatcher.php(56): ShellDispatcher->_initEnvironment()
    #5 /usr/share/php/cakephp/lib/Cake/Console/ShellDispatcher.php(67): ShellDispatcher->__construct(Array)
    #6 /usr/share/php/cakephp/lib/Cake/Console/cake.php(51): ShellDispatcher::run(Array)
    #7 {main}
    thrown in /usr/share/php/cakephp/lib/Cake/Cache/Cache.php on line 166

    Fatal error: Uncaught exception ‘CacheException’ with message ‘Cache engine _cake_core_ is not properly configured.’ in /usr/share/php/cakephp/lib/Cake/Cache/Cache.php:166
    Stack trace:
    #0 /usr/share/php/cakephp/lib/Cake/Cache/Cache.php(136): Cache::_buildEngine(‘_cake_core_’)
    #1 /usr/share/php/cakephp/lib/Cake/Console/Templates/skel/Config/core.php(336): Cache::config(‘_cake_core_’, Array)
    #2 /usr/share/php/cakephp/lib/Cake/Console/ShellDispatcher.php(133): include_once(‘/usr/share/php/…’)
    #3 /usr/share/php/cakephp/lib/Cake/Console/ShellDispatcher.php(100): ShellDispatcher->_bootstrap()
    #4 /usr/share/php/cakephp/lib/Cake/Console/ShellDispatcher.php(56): ShellDispatcher->_initEnvironment()
    #5 /usr/share/php/cakephp/lib/Cake/Console/ShellDispatcher.php(67): ShellDispatcher->__construct(Array)
    #6 /usr/share/php/cakephp/lib/Cake/Console/cake.php(51): ShellDispatcher::run(Array)
    #7 {main}
    thrown in /usr/share/php/cakephp/lib/Cake/Cache/Cache.php on line 166

    got stuck here. Please help me out

    • mazkt · July 1, 2013

      just need to change the permission of the cakephp core to 777

      • Marcelox5 · July 23, 2013

        How do I do that? I already did it at work, but I forgot.

      • Marcelox5 · July 23, 2013

        Nevermind. I just did this:

        sudo chmod -R 777 /usr/share/php/cakephp/lib/Cake/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s