Skip to content
augustohp edited this page Sep 14, 2010 · 11 revisions

Below are the instructions and requirements to run the application.

Requirements

  • PHP 5 or greater
  • Databases supported are: MySQL, Sqlite, Postgres, Mssql, Db2, Oracle, Firebird and Odbc
  • Apache and mod_rewrite are desirable

Getting and installing the application

First, download the zip file containing the source of the application, it can be done by clicking here.
Unzip the file and you will get a folder with all the source inside.You can rename this folder to whatever you want and put it inside the document root of your web server.
Make sure you give permissions to read all the files to the user of your web server.

Write permission

You need to give the web server access to write in some directories, they are:

  • /app/tmp/cache
  • /app/tmp/logs
  • /app/tmp/sessions
  • /app/webroot/img/upload/Speaker

Rewrite & Beautiful URLs

CakePHP has support for URL rewriting using Apache’s mod_rewrite. If you are not using apache, or doesn’t have mod_rewrite enabled in your server, you still can run the application but you will not have the sexy-urls thing.
If you use Apache and has mod_rewrite enabled, the application will work as-is. But if you haven’t, you just need to follow these steps:

  • Open /app/config/core.php
  • Un-comment line 68 of this file, the line should end up like this:
    • Configure::write('App.baseUrl', env('SCRIPT_NAME'));

Database

Create a new and empty database with a utf8_general_ci collation, or a utf8 compatible collation or charset depending on your database.
In our case, let’s say the configurations to access our database are:

  • Server: MySQL
  • Host: 127.0.0.1
  • User: root
  • Password:
  • Database: cfp

Configuring the database into the application

With the database created, you have to configure CakePHP to access the database, to do that:

  • Rename/Copy the /app/config/database.php.default to /app/config/database.php
  • Edit the /app/config/database.php to look like this: (supposing the above mentioned scenario)
var $default = array(
		'driver' => 'mysql',
		'persistent' => false,
		'host' => '127.0.0.1',
		'login' => 'root',
		'password' => '',
		'database' => 'cfp',
		'prefix' => '',
	);

Available drivers to use in the configuration array mentioned above are:

  • mysql
  • mysqli (if this module is available, prefer this one to MySQL databases)
  • sqlite
  • postgres
  • mssql
  • db2
  • oracle
  • firebird
  • odbc

Running tables creation and schemas update

We will use for that a feature from CakePHP called schemas. To that we have to use the cake console tool, so let’s point our shell to were the executable file for cake console is. This works on Unix and Windows platforms, the only difference is that the script for Unix platforms is called just cake and for Windows it is called cake.bat.

cd /path/to/the/application/root
cd cake/console
./cake schema create
./cake schema update -s 2

What we made first is to create the base schema, and them run the first snapshot update to the database. It can exists any amount of updates in the project, how can you know the exact number of them? By going to /app/config/schema and looking for schema_*.php files. Currently there is only one file called schema_2.php, that’s why we used the number 2 in the schema update. To build the correct database, you must execute all available updates.

Running the application

After all that is done, you can point your browser to the address and actually see the application. You will see a login form with a registration link. Register yourself first of all and go on.

Debug mode

By nature, the application is configured to run in production environments, that means all errors are suppressed and if they come to happen, a beautiful and withe screen is presented. How can you change that? By telling CakePHP that you want to run in Debug mode, here is how to do it:

  • Open /app/config/core.php
  • By line 37 of this file you will find the Debug option, what values can it take:
    • 0 – Production
    • 1 – Development
    • 2 – Development + SQL executions

So if you are a developer, the right value of this options is 2 (two), like this:
Configure::write('debug', 2);