The Intro

CakePHP is an open-source framework for PHP intended to make developing, deploying and maintaining applications much easier. CakePHP offers many useful design patterns, such as the Model-View-Controller pattern, seen in other popular frameworks like Ruby On Rails. The CakePHP framework also provides a slew of valuable reusable libraries for dealing with common tasks

Why Should you go for Cake PHP

A significant amount of development time with PHP is spent rewriting common code for routine operations such as database access or returning data to the browser. Of course, all this routine code can quickly become disorganised in traditional PHP applications. What is needed is a framework for PHP that does what Ruby On Rails did for Ruby.

Below are just a few things CakePHP offers to make development easier.

  • Free Open-Source MIT License allowing you to use CakePHP applications within any of your own projects.
  • Compatibility with both PHP4 and PHP5. The minimum version needed is 4.3.2.
  • Support for MySQL, PostgreSQL SQLite, PEAR-DB and wrappers for ADODB, a database abstraction library.
  • Model-View-Controller layout.
  • Easy CRUD (Create, Read, Update and Delete) database interaction.
  • Scaffolding to save production time.
  • Search Engine Friendly URLS.
  • Input validation and sanitization tools to make your applications much more secure.
  • Templating with familiar PHP syntax.
  • Caching Operations.

Installing the Framework

You will need your own copy of the framework uploaded to your server. Go to and click the large “Download” button. Make sure to download the stable release and not the release candidate. There are also many different file formats available so you can pick the best one for your computer.

Up-loading and Knowing the File Structure

Once you have downloaded your copy of CakePHP , the next step is to put it in oven,i.e.  upload the copy to a PHP and MySQL enabled webserver like WAMP, . I would ask you in creating a new directory for CakePHP projects.

Your CakePHP project folder Structure will be as follows,

Configuring CakePHP

We need to tell CakePHP our database details and set up how we want the core functionality to work.

For development purposes you should create a new database and a user with the following privileges: ALTER, CREATE TEMPORARY TABLES, CREATE, DELETE, DROP, SELECT, INSERT, UPDATE, REFERENCES, INDEX, LOCK TABLES.

Once the user and database have been created, we can find CakePHP’s database configuration file, located in /app/config/database.php.default

Open and scroll down to the following array

  1. var $default = array(‘driver’ => ‘mysql’,
  2. ‘connect’ => ‘mysql_connect’,
  3. ‘host’ => ‘localhost’,
  4. ‘login’ => ‘user’,
  5. ‘password’ => ‘password’,
  6. ‘database’ => ‘project_name’,
  7. ‘prefix’ => ”);

and fill in your database details as necessary

Lets Check if it Works…

Once you have entered the correct database details and uploaded all the CakePHP files, the installation should be ready for development. Open localhost in your browser and go to the folder that you uploaded the installation to. If everything is working, you should be able see the success page.