December 17, 2014

December 17, 2014
In this article, we are going to discuss about How to install DebugKit in CakePHP on ubuntu 14.04. CakePHP is an open source web application framework. It follows the Model-View-Controller (MVC) approach and is written in PHP, modeled after the concepts of Ruby on Rails, and distributed under the MIT License.

CakePHP uses well-known software engineering concepts and software design patterns, as Convention over configuration, Model-View-Controller, Active Record, Association Data Mapping, and Front Controller.

Requirements to install DebugKit:

  1. CakePHP 2.2.0 or greater.
  2. PHP 5.3.0 or greater.

Follow the below steps to install DebugKit in CakePHP on Ubuntu.

Step 1: 

Open terminal and first of all install git if not installed already.

$ sudo apt-get install git

Step 2: 

Go to app/Plugin folder where DebugKit will be installed.

$ cd /var/www/html/cake/app/Plugin

Now initialize git repository here so that we can clone the DebugKit through GitHub using git.

$ sudo git init

Step 3:  

To clone DebugKit type this command:

$ sudo git submodule add

or use this command:

$ sudo git clone

When this process is done then a folder will be created named as debug_kit in Plugin folder. Rename this folder as DebugKit. Type following command to do this:

$ sudo mv debug_kit/ DebugKit

[Note: Make sure you are in the Plugin folder.]

Step 4: 

Go to app/Config folder

$ cd /var/www/html/cake/app/Config
$ sudo nano bootstrap.php

Add this line in the file CakePlugin::load('DebugKit'); if not already present.

Press ctrl+x, press y and enter to save file. Refresh localhost/cake page. Now DebugKit is detected.

Step 5: 

After this check whether this line is present in core.php file or not Configure::write('debug',2); If it's not present then add this line and save file. Core.php file is present in app/Config. To edit this file type this:

$ sudo nano core.php

Step 6: 

Now add DebugKit toolbar. Go to app/Controller folder.

$ cd app/Controller
$ sudo nano AppController.php

Add the red text color line in the empty class AppController which is present at the end of the file.

class AppController extends Controller {
         public $components = array('DebugKit.Toolbar');

Press ctrl+x, press y and enter to save file. Refresh localhost/cake page. DebugKit toolbar is added at the top right end of the page.

Step 7: 

After this go to app/View/Layouts folder to remove sql_dump.

$ cd app/View/Layouts
$ sudo nano default.ctp

Comment the following line present at the end of file embedded in php tags i.e. in between these tags <?php ?>

<?php //echo $this->element('sql_dump'); ?>

Press ctrl+x, press y and enter to save file. Refresh localhost/cake page.

Installation is DONE!!! Hope you get the points and this post is helpful for you. If you have any query then comment on the post. i'll get back to you as soon as possible. All The Best.


Post a Comment