CakePHP, the first steps:


1. Installing CakePHP:

To install cakePHP, go to : cakeforge.org and dowload the file cake_1.1.19.6305.zip.

Unzip cake_1.1.19.6305.zip, and rename as cakes the obtained cake_1.1.19.6305 directory. Place this directory cakes in the one where PHP runs, that is the (host, port) configured in Apache. (here : localhost:8033, the related directory is C:\www).

Edit the Apache httpd.conf Configuration File, and uncomment the line: LoadModule rewrite_module modules/mod_rewrite.so

We can, if we do not have Apache and PHP already installed, download from www.apachefriends.org and install the XAMPP(Windows XP, Apache, MySQL, and PHP) program.

Once we have Apache, PHP, and MySQL installed, edit the Apache httpd.conf Configuration File, and uncomment the line: LoadModule rewrite_module modules/mod_rewrite.so
We are ready to start working with CakePHP.

2. database.php

2.1. Create a database. For example of name "cake". Open MySQL command line. Create a database "cake" and a table "contacts" as follows

2.2. Configure your cakePHP for these tatabase: In the directory :\app\config\, change the file database.php.default to: database.php. Open this file and configure as folows:

3. The first things:

3.1. In the directory: \app\controllers\, create the file : contacts_controller.php as follows:
<?php
class ContactsController extends AppController {
var $name = 'Contacts';

function index() {
$this->set('contacts', $this->Contact->findAll());
}

}
?>


3.2. In the directory: \app\models\, create the file : contact.php:
<?php
class Contact extends AppModel {
var $name = 'Contact';
}
?>


3.3. In the directory: \app\views\, create a subdirectory:\contacts \ in which we create the file : index.thtml

3.4. The related result: We can then obtain: contactCakePHP at localhost