Posts Tagged ‘ bake ’

Installing CakePHP on Ubuntu

CakePHP is a rapid development framework for PHP that provides an extensible architecture for developing, maintaining, and deploying applications. Using commonly known design patterns like MVC and ORM within the convention over configuration paradigm, CakePHP reduces development costs and helps developers write less code.

Installation is actually quite an easy task. But I couldn’t find good information at the beginning. So here I am writing for you. I am using Ubuntu 9.10. This will work for any *nix systems.

Step 1:

In order to work with cakephp you need to have Apache server , MySql Database and PHP. To get them

sudo apt-get install apache2 mysql-server php5

Step 2:

Download the Latest version or the stable version of Cakephp. You can get it from here download
I am using 1.2 version of cakephp

Step 3:

Copy and Extract the compressed file to the webroot(/var/www) and rename to cakephp or some project_name. Open http://localhost/cakephp in your browser. You will see something like this.

cakephp installation step3cakephp installation step3

Step 4:

Enable write permission for app/temp
sudo chmod -R 777 cakephp/app/tmp

Step 5:

Enable mod_rewrite. More about mod_rewrite here.

sudo a2enmod rewrite

Step 6:

Edit the file /etc/apache2/sites-enabled/000-default and change AllowOverride None to AllowOverride All. You can use any text editor. I am using vi editor.

sudo vi /etc/apache2/sites-enabled/000-default

<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

Step 7:

Changing the value of security.salt in app/config/core.php. At line 151 or near to it you can see something like this
Configure::write(‘Security.salt’, ‘DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi’);

Just change the value of it.I have come up with this value
Configure::write(‘Security.salt’, ‘UubWwvniR2G0FgaC9miDYhG93b0qyJfIxfs2guVo’);

Step 8:

Database Configuration. The database configuration file is located at cakephp/app/config/database.php.default
change the file name to database.php
sudo mv database.php.default database.php

Then edit the following

sudo vi cakephp/app/config/database.php


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

You can connect to any database you want. Make sure that username and password of your database are correct.

Step 9:

Restart Apache server to see changes
sudo /etc/init.d/apache2 restart

Step 10:

Open http://localhost/cakephp/ in your browser.If all goes well you should be able to cakephp page in colors, something like this.

cakephp installation step10cakephp installation step10