How to setup and configure cakephp for beginners

Today this post is for cakephp beginner for those people who wants to switch from corephp to any framework, Moving from corephp to framework is good idea because when you will start working on framework your development will be fast because frame works pre-defined plugins and libraries. which we used to create in corephp.

There is lot’s of framework available on web you can choose any of them according to your need. each frame work has unique feature.


So Lets start our cakephp installation and configuration.

Step:1- Download latest version of cakephp 2 from http://cakephp.org
Note: This tutorial is about cakephp V2

After you’ve downloaded and extracted CakePHP, these are the files and folders you should see:
cakephp-1

Step-2:
Make sure that read and write permission is on for app/tmp folder if not then allow.
below command in linux to give full permission.

sudo chmod -R 777 cakephp/app/tmp

Run your localhost url on browser http://localhost/cakephp you’ll see below page
cakephp-2

Step-3:
Change the value of Security.salt & Security.cipherSeed in /config/core.php file.

app/config/core.php


    Configure::write('Security.salt', 'ROHITDYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi');
 

    Configure::write('Security.cipherSeed', '955576859309657453542496749683645');

Now your first two notice will be fixed.

Step-4:
Time to configure your database, first rename the file from database.php.default to database.php which you can find in app/config/ folder.
Now your database file is available for connect with database.

Step-5:
Create a database in your mysql using phpmyadmin or any other software which you are using to access to mysql.
After that place your database details in database.php file

app/config/database.php

public $default = array(
        'datasource' => 'Database/Mysql',
        'persistent' => false,
        'host' => 'localhost', 
        'login' => 'user',  
        'password' => 'password',  
        'database' => 'database_name', 
        'prefix' => '',  
        //'encoding' => 'utf8',
    );

Step-6: This is final configuration step to configure cakephp debug kit for your project. Download Cakephp Debug Kit from github https://github.com/cakephp/debug_kit
extract and place it under app/Plugin/ folder and rename it from debug_kit-master to DebugKit
it look like app/Plugin/DebugKit
and open file app/Config/bootstrap.php and paste below code.

app/Config/bootstrap.php

CakePlugin::load('DebugKit');

This step is not essential but will help you to debug your cakephp code if you do.

Now your all notice will be fixed after doing all the steps successfully and you will see below page.
cakephp-3

Hope this cakephp beginner tutorial will help you to configure cakephp in your system. 🙂

If you like this post please don’t forget to subscribe My Public Notebook for more useful stuff.