This is documentation for Kohana v2.3.x.
Status | Draft |
---|---|
Todo | Create the rest of the config option descriptions. |
These are the options available in the core configuration file config.php
.
Either the domain, domain+path, or just path of the site.
// All are valid values $config['site_domain'] = 'example.com/'; $config['site_domain'] = 'example.com/kohana/'; // Using this option requires that you have $config['site_protocol'] set. // The domain will automatically be detected in this case. $config['site_domain'] = 'kohana/';
The default protocol to be used in URIs throughout your application.
This option can be left blank, and whatever is currently in use will be used.
// Given the current URI for the request is "http://example.com/", the protocol will default to "http". $config['site_protocol'] = ''; // Unless specified otherwise, URIs will use the https protocol. $config['site_protocol'] = 'https';
The name of the front controller, which, unless you're swapping stuff around, will be index.php
.
The whole point of URI segments is to avoid stuff like this and improve your SEO. URL rewriting should be used to this can be left blank.
// Will yield page links like: http://example.com/page/link $config['index_page'] = ''; // If you're not using URL rewriting, you need to have the front controller specified. // Will yield page links like: http://example.com/index.php/page/link <-- fugly. $config['index_page'] = 'index.php';
A file suffix to append to all URLs. Used to “fake” a file extension. The purpose is to allow dynamic pages to appear to be static pages.
A more esoteric usage could be to confuse bots, by appending ”.asp” for example.
// Will yield page links like: http://example.com/articles/my_first_article.php $config['url_suffix'] = '.php';
Enables the store of filepaths and config entries across requests so Kohana doesn't need to update every request. Set this to the number of seconds you want to cache file paths and config entries. This eliminates the need to search for file and module paths, significantly speeding up your application – especially when using multiple modules.
// Will enable the cache for 60 seconds. $config['internal_cache'] = 60;
Enables compression of data sent to the browser. To work, the browser must be able to handle the compressed format - (All modern browsers do, IE6 may barf).
Enabling this option can greatly reduce bandwidth. Especially for pages which are mostly HTML text.
Note: PHP can be automatically configured to do the same thing, by setting 'zlib.output_compression', 'On' in PHP.ini. If you cannot change your server PHP.ini, then you should use Kohana's output compression.
DO NOT use both at the same time, the output data will be corrupted.
// FALSE to disable, 1 - 9 for desired compression level, 9 is the maximum and may chew CPU. $config['output_compression'] = 5;
By default, site-wide global xss filtering is enabled, and all user inputs will be sanitized using the Input library's xss_clean() method.
$config['global_xss_filtering'] = TRUE;
To disable global_xss_filtering, simply set it to FALSE.
If, when you downloaded Kohana, you selected the optional HTMLPurifier vendor tool, then you can use it instead of the default xss_clean() method:
$config['global_xss_filtering'] = 'htmlpurifier';
Enabling this option will either include all files in the hooks
directory or if specified with an array - specific files.
// Will include power.php only $config['enable_hooks'] = array('power.php')
Sets the logging level within Kohana. * 0 - Disable logging * 1 - Errors and exceptions * 2 - Warnings * 3 - Notices * 4 - Debugging
$config['log_threshold'] = 1;
Specifies where to store application logs.
$config['log_directory'] = APPPATH.'logs';
Turning this off will disable all outputting of errors to the user. It will however be logged to the log directory.
Whether or not to render the statistics information in the final page output.
Example
// TRUE is default, set to FALSE to disable it. $config['render_stats'] = TRUE;
The following items are normally replaced in Kohana::render()
.
array ( '{kohana_version}', '{kohana_codename}', '{execution_time}', '{memory_usage}', '{included_files}', )
Keep in mind; having render_stats
set to false will leave the raw replacement strings in your page, visible to all. It does not replace them with empty strings—it just disables the replacement. So take them out if you're not using them!
As an aside, if you still want some string replacements, but either want just a sub-selection of these, or to use your own, an option would be to create a hook using Event::add_before()
on system.display
.
When extending a core component, i.e. libraries or helpers, this will be used as the prefix for the file names.
For example, if you want to extend Controller_Core
:
// This is the default $config['extension_prefix'] = 'MY_'; // But you could set it to this $config['extension_prefix'] = 'Ext_';
Given you decide to leave your prefix at the default, you would put the following code into MY_Controller.php
under the libraries
folder in your application
directory:
<?php defined('SYSPATH') or die('No direct script access.'); /** * This is my custom controller with awesome stuff that I need. * File name: MY_Controller.php */ class Controller extends Controller_Core { // Blah }
Additional resource paths, or “modules”.