Page 1 of 1

CakePHP: Installation + Configuration Rate Topic: -----

#1 shadowstep0705   User is offline

  • New D.I.C Head
  • member icon

Reputation: 6
  • View blog
  • Posts: 48
  • Joined: 26-May 10

Posted 08 June 2011 - 08:41 AM

1. Intro
Hi everyone, today I will explain you how to setup a working copy of the CakePHP framework.
The guide in the cookbook isn't that clear as it should be.

2. Prerequisities
What you should already have:
  • A working HTTP server, supporting sessions with mod_rewrite working.
  • A working PHP version. (At least 4.3.2)
  • A database server.

After installing everything, you need to download the latest CakePHP version. You can dowload it from Within this tutorial, I am using version 1.3 stable.

3. The installation
Unpack the download .zip file to your webroot directory (the htdocs folder with Apache). Now, check localhost for the result.

If everything went alright, you should get something like this:
Attached Image

You could also get the following:
Attached Image

This means that mod_rewrite is not activated. You should fix this if you want to continue.

4. The configuration
A common website is nothing without a database. That something we are going to do in this chapter: configuring the database connecion.

So, first go to /<webroot>/app/config and rename database.php.default to database.php.
Then open it with your favorite text editor.
To go the end of the file, you should change your settings in here:
var $default = array(
                'driver' => 'mysql',
                'persistent' => false,
                'host' => 'localhost',
                'login' => 'user',
                'password' => 'password',
                'database' => 'database_name',
                'prefix' => ''

Driver can be postgres, sqlite, mssql, mysql, mysqlidb2, or oracle
Persistent means CakePHP should use persistent database connections
Host is the hostname or the IP adress of your database server, this might be localhost as well as
Login is the username to log in into your database
Password is the password to log in into your database
Database is the name of the database you are using
Prefix is the prefix of the tables you wish to use. This if only of any use if you are limited to 1 database, and there are also tables who aren't used by CakePHP

Now save that file.

Go to localhost again.
It should give you this:
Attached Image

If you get something else, you might have misnamed or misplaced the database file. Check wether it is in /<webroot>/app/config and it is named database.php. (not database.php.default)

At this moment, you should only have two errors left:
  • Notice (1024): Please change the value of 'Security.salt' in app/config/core.php to a salt value specific to your application [CORE\cake\libs\debugger.php, line 684]
  • Notice (1024): Please change the value of 'Security.cipherSeed' in app/config/core.php to a numeric (digits only) seed value specific to your application [CORE\cake\libs\debugger.php, line 688]

Open /<webroot>/app/config/core.php with your favorite texteditor and search for the following lines:
Configure::write('Security.salt', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi');

Change the second parameter to something random. You really should, else it is the same as all the other sites who are using CakePHP.

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

Do the same now, but only use numbers this time.

This should be your homepage right now:
Attached Image

5. The end
So, I hope you learnt something today, and that you will enjoy the use of CakePHP in the future.

Cya :D

Is This A Good Question/Topic? 3
  • +

Page 1 of 1