In this blog, we will guide you about what is cake PHP and how to Install CakePHP 3 step by step. This tutorial is meant for web developers and students who would like to learn how to install and change its database settings using CakePHP. It will provide a good understanding of how to use this framework.


CakePHP framework: An Overview

This remarkable PHP framework "CakePHP" is an open-source for generating the major web applications. It lets you develop such applications much quicker and also executes your task more manageable by depreciating the necessity of building your application from scratch.

Using PHP framework, the developers are enabled to work in a structured and speedy manner, without losing compliance. A foremost advantage of CakePHP is the appearance of an active developer team and a solid community of users.

About Latest Version:

As per CakePHP 4.0.0 is as tasty as other major CakePHP releases but will now require you to use PHP 7.2. With a refreshed application skeleton design, CakePHP 4.0.0 comes with a streamlined API making your development and application faster.

While 4.0 contains a number of breaking changes we have prepared an exhaustive migration guide covering all the deprecated and removed features as well as highlighting the shiny new features.


Before you continue with this tutorial, we hope that you have experience of HTML, Core PHP, and Advance PHP. If you have knowledge about these advanced essentials then learn about CakePHP's installation process in the below section:

How to install CakePHP?

Before we proceed, it is best that you install XAMPP first, which contains PHP, Apache, and MySQL. Let’s get cracking then!

1: Download XAMPP and CakePHP

2: Install XAMPP

Once you have installed XAMPP (version 1.7.3) on your Windows with the default option, all your files will be located in the C:/xampp folder.

3: Mod Rewrite Module

Once XAMPP is installed as the local server, you can then proceed to enable mod_rewrite. To do so, you will have to open the httpd.conf file that is located in C:/xampp/apacheconf and uncomment by removing # from the following line: # LoadModule rewrite_module modules/

4: Place CakePHP Files in a New Folder

Extract the CakePHP (version 1.3.8) zip file and copy all its contents to your local web server, which in this instance is C:/xampp/htdocs/jack. I have decided to name the CakePHP folder as jack and in it, you will find many files and folders for the framework, including app, cake, docs, vendors, .htaccess, and index.php.

5: Set Up Virtual Host
Open the httpd-vhosts.conf file from the C:/xampp/apacheconf/extra in order to set up a new virtual host that can run your CakePHP application. You will have to add the following lines in order to run the application:

 <strong>NameVirtualHost *:80

 <VirtualHost *:80>

 ServerAdmin webmaster@localhost

 DocumentRoot C:/xampp/htdocs/jack

 <Directory "C:/xampp/htdocs/jack">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all

  <VirtualHost *:80>    
  ServerAdmin webmaster@localhost    
  DocumentRoot C:/xampp/htdocs/xampp    
  ServerName localhost
     <Directory "C:/xampp/htdocs/xampp">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all

The httpd-vhosts.conf file will have the aforementioned configuration for virtual hosts to run CakePHP and other php applications. I have decided to choose as the server name, and likewise, we will have to add it to the C:/Windows/System32/drivers/etchosts file as mentioned below:


If your web server is already running, restart it so that you can access the new CakePHP installation by growing to through your browser.

6: Setting Up Database Connection

Start off setting up your database connection by renaming the database configuration file to database.php file from database.php.default file, as found in the C:/xampp/htdocs/razib/appconfig folder. Now open the database.php file and enter a username, password, and database name to the ‘$default’ connection variable:

var $default = array (
'driver' => 'mysql' ,
'persistent' => false
'host' => 'localhost' ,
'login' => 'root' ,
'password' => ' ' ,
'database' => 'jack' ,
'prefix' => ' ' ,

7: Run CakePHP

Open on any browser and CakePHP can now access the database configuration file!

How to change database settings?

1. Open app.php file from config folder.

2. Then Find Datasources array in the file.

'Datasources' => [
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => 'localhost',
* CakePHP will use the default DB port based on the driver selected
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
* the following line and set the port accordingly
//'port' => 'non_standard_port_number',
'username' => 'root',
'password' => '',
'database' => 'myDatabase',

'encoding' => 'utf8',
'timezone' => 'UTC',
'flags' => [],
'cacheMetadata' => true,
'log' => false,
* Set identifier quoting to true if you are using reserved words or
* special characters in your table or column names. Enabling this
* setting will result in queries built using the Query Builder having
* identifiers quoted when creating SQL. It should be noted that this
* decreases performance because each query needs to be traversed and
* manipulated before being executed.
'quoteIdentifiers' => false,
* During development, if using MySQL
< 5.6, uncommenting the
* following line could boost the speed at which schema metadata is
* fetched from the database. It can also be set directly with the
* mysql configuration directive 'innodb_stats_on_metadata =
* which is the recommended value in production environments
//'init' =>
['SET GLOBAL innodb_stats_on_metadata = 0'],
'url' => env('DATABASE_URL', null),


Why is CakePHP best for Web App development?

Nowadays, there are several open-source alternatives that are simply convenient for many of the companies only to build up their web applications. Moreover, CakePHP is an extreme and exceptional PHP development system that completely allows developers to build site and web applications rapidly. The Web Service of Cakephp additionally provides an essential structure for sorting out records and database table names.

Now look at the few reasons that explain why CakePHP is worldwide popular in Web Application:

  1. Easy and Quick: CakePHP underpins viable and fast methods for the documentation. Consequently, it is very easy to do the documentation for the designers without wasting excessive time for this procedure.
  2. Friendly & Supportive: CakePHP Development which is uniformly developed to share data and expand from each other with such immense numbers of subscribers, it is usually friendly and supportive for the software engineers to quickly acquire the latest instruments and highlights of the CakePHP.
  3. Manageable for data administration: Database administration is totally easy and manageable with the support of CRUD combination highlight. This component provides more additional functionalities to the swift and successful database administration work.

Advantages of CakePHP

  • CakePHP one can easily install and operate software tools
  • A brilliant file manager
  • There are multiple language options in CakePHP
  • This PHP framework can also be used for e-commerce websites and blog sites.
  • Manage content and Themes
  • User management features
  • Helps reduce web application development cost & time considerably.
  • RSS feeds and comments
  • Have customized fields and templates

Disadvantages of CakePHP

  • One-way routing in CakePHP often proves to be a disadvantage when compared with frameworks such as Ruby on Rails.
  • While using CakePHP, one needs to update the default routes for creating Fancy URLs. If compared with other frameworks such as Symfony, CakePHP loses battle in this case.
  • Many still believe that CakePHP is easier to learn. But they haven’t come across frameworks such as CodeIgniter which make learning all the easier!
  • The documentation for CakePHP definitely needs some work.

Bottom Line

CakePHP has proved to be a very valuable tool and we can say that it has become a favourite among developers. With its amazing features for translating, caching, validating and authenticating, it is the most competent choice for developing a comprehensive content management system.

So what are you waiting for? Get out there and build something!

PS: If you liked, then kindly share your kind reviews in the comments section below. And to stay in touch and not miss any of our articles/blogs, then do subscribe to our newsletter, and check out our blog page

PPS: Follow us on our Social media handles: Medium:, Facebook:, LinkedIn, GitHub: Do check out our recent repositories at