Tuesday, May 12, 2009

Cake is a PHP web development framework which employs the MVC model. I will describe how to set it up on a win32-based machine.

First install xampp (the lite version is fine) which consists of Apache, PHP, and MySQL. The install process just copies some files to a specified folder.

Next, run “setup_xampp.bat” located on the root xampp folder.

After that open “httpd.conf” located on “apache\conf” folder. Then uncomment the line that contains “mod_rewrite”. This is needed to enable Cake’s pretty URL such as “http://localhost/cake/users/view” instead of “http://localhost/cake/index.php/users/view”.

Afterwards, extract Cake somewhere in the “htdocs” folder. I usually put it in “htdocs\cake”.

The last step is to copy “database.php.default” in “app\config” of Cake’s folder to “database.php”. Then change the “$default” variable to suit your database settings. An example is:

class DATABASE_CONFIG
{
var $default = array('driver' => 'mysql',
'connect' => 'mysql_connect',
'host' => 'localhost',
'login' => 'root',
'password' => '',
'database' => 'test',
'prefix' => '');
}

Which works with the default MySQL in xampp.

To see if things are working properly, run “xampp-control.exe” in xampp’s root folder and then start Apache and MySQL from there:

Starting Apache and MySQL

After that point your browser to “http://localhost/[cake's root folder]” for example “http://localhost/cake”.

Here’s some goodies:

Cake 1.1.5.3148
Cake 1.1.5.3148

Cake 1.1.6.3264
Cake 1.1.6.3264. Cleaner???

To learn how to use it, read “The Cake Blog Tutorial” in CakePHP Manual.

No comments:

Post a Comment