Configuring Cora

IF you installed Cora to your root web directory, it should already be working. Test by going to


If it loads something, then Cora is working. If it doesn't work, then you probably either need to enable .htaccess files usage in apache, enable mod_rewrite in apache, you changed the name of something before reaching this article, or you didn't install Cora to your root web directory. If you are using one of the suggested AMP packages from the installation page, everything should theoretically be working though.

If you didn't install Cora into your root directory, no worries, you'll just need to run through the following config instructions first before things will work.

Step 1: Change the Name of the Directory to Match Your Project

By default, the folder for Cora that got copied into your web directory should be named "cora". Just a guess, but you probably want to change this to match the name of the project you plan on building. If for instance you want to create an app called "My Awesome Site", go ahead and rename that cora directory to "MyAwesomeSite".

Step 2: Change Your .htaccess File to Match Your Directory Name

Continuing our "MyAwesomeSite" example, next you would need to open up the hidden ".htaccess" file located within that directory and change the third line down to:

RewriteBase /MyAwesomeSite

OR, if you installed Cora into a subfolder within your web directory, then you will need to include the full path from your root like so:

RewriteBase /someFolder/MyAwesomeSite

Performance Note
While on this topic, it should be noted that using a .htaccess file does have a performance cost. If you are planning on making an enterprise level app that serves a large number of users, you'll probably want to eventually get rid of the .htaccess file and instead place the mod_rewrite rules into your server config. Doing this is beyond the scope of this documentation, but it's just something of which you should be aware.

Step 3: Update the Site_Url in Your Config

Next you need to open up the "cora/config/config.php" file in your project. The full path to this file should look something similar to this:


The first thing you should see are some commented out examples of commonly changed options like:

#$config['debug'] = true;
#$config['debugHide'] = false;
#$config['site_url'] = '/cora/';
#$config['cora_extension'] = 'MyApp';

Note that this config file overrides any defaults that are located in


Go ahead and uncomment the line for 'site_url' and change the value to match your new directory name. If your project is embedded in sub-directories, you do not need to include the full path, just the name of the folder the Cora project files are within. Example:

$config['site_url'] = '/MyAwesomeSite/';

Step 4: Create Your Project Controller

Go ahead and open up any of the example controllers that are included in the controllers directory. The class declaration should look something like:

class Articles extends \MyApp {

Anytime you create a new controller, you want to have it extend from some "base" controller, which in the case above is "MyApp". This allows you to have shared data and methods across all your controllers when necessary. Although you can leave the name of this base controller as "MyApp" if you want to, we're guessing you'll probably want to change this to something more official sounding that matches the name of your project.

Navigate to the "cora/extensions/MyApp.php" file in your project and make a copy of it, renaming the copy to "MyAwesomeSite.php". After you do this, make sure you open the file and change the class name to MyAwesomeSite too. It should look like the following:

class MyAwesomeSite extends Cora

Then go back and edit the Articles controller to extend from your new base class. Note that once you complete this setup guide and confirm everything is working, you'll then be able to go back and delete the MyApp file later if you want.

Step 5: Make All Controllers Extend From Project Controller

Now that you have your base project controller ready, you need to open up each of the controllers under your "controllers" directory and change them to extend from your new base controller instead of MyApp. They should all follow this format:

class Articles extends \MyAwesomeSite {

Step 6: Configure Your Database

Next you need to open up the "cora/config/database.php" file in your project. The full path to this file should look something similar to this:


Within this file you'll find a listing of connections and a way to set the default connection. You need to edit this with the connection info for your database(s). It follows this format:

$dbConfig['defaultConnection'] = 'MyFavoriteConnection';
$dbConfig['connections'] = [
    'Connection1' => [
        'adaptor'   => 'MySQL',
        'host'      => 'localhost:3306',
        'dbName'    => 'cora',
        'dbUser'    => 'root',
        'dbPass'    => 'root'
    'Connection2' => [
        'adaptor'   => 'MySQL',
        'host'      => 'localhost:3306',
        'dbName'    => 'cora2',
        'dbUser'    => 'root',
        'dbPass'    => 'root'
    'MyFavoriteConnection' => [
        'adaptor'   => 'MySQL',
        'host'      => 'localhost:3306',
        'dbName'    => 'cora3',
        'dbUser'    => 'root',
        'dbPass'    => 'root'

If you are using a package like XAMPP, MAMP, etc, you'll probably want to go to


and create a database first before you can fill in this database config. So look into doing that if you haven't already.


That's it! You should be able to run your project and play around with it and the included demos now. If you are an experienced user who wants to know about the advanced configuration options within Cora, or how Cora can be incorporated into an existing software project, click here to view the advanced configuration tutorial. Otherwise, click below to continue on to the introductory tutorial to help you get acquainted with Cora.

Next: Introduction to Cora