How to configure CakePHP part1

Sep 13, 2007 15:16 GMT  ·  By

Now that you know what CakePHP is and what you can do with it, I will help you to install it so you may start building your first application. Before starting downloading the installation kit, verify if you comply with the requirements: a webserver (Apache, IIS, etc), PHP (4.3.2 or greater) and a database server (MySQL, PostgreSQL and a wrapper for ADODB). If you comply with the requirements, download the installation kit and let's start installing it. The webserver must have sessions and mod_rewrite enabled. If you want to text the latest features of CakePHP download the alpha version, but if you only need the stable version, download it from here.

Extract the files from the arhive and copy the files in htdocs (for Apache users) or wwwroot(for IIS users). Here the htdocs/wwwroot folder acts like your web root (you must use mod_rewrite). Another way to install CakePHP is to change DocumentRoot from your server, so all of your domain will act as a simple CakePHP application. Change DocumentRot to look like this: DocumentRoot /path_to_cake/app/webroot.

Next, we will configure CakePHP. First, let`s configure the database. You will find the database configuration file in app/config/ and is named database.php. Change from

var $default = array(

'driver' => 'mysql',

'connect' => 'mysql_connect',

'host' => 'localhost',

'login' => 'user',

'password' => 'password',

'database' => 'project_name',

'prefix' => '');

with the data from your database server: driver (what server you use: mysql, postgresql,sqlite), host (your server ip or name), login (user name of the database server), password (the password for the server), database (database name), prefix (if you want to change to "cakephp_" ) and connect (allows you to specify whether or not the database connection will be treated as persistent or not).

In the next article we`ll learn how to configure global variables in CakePHP