Anda di halaman 1dari 6

Craft CMS General Config Settings

Craft comes with a bunch of config settings that give you control over various a
spects of its behavior.
All config settings should be placed within the array() in your craft/config/gen
eral.php file.
For example, if you want to enable Dev Mode and set Craft to use uncompressed Ja
vascript files, your array would look like this:
return array(
'devMode' => true,
'useCompressedJs' => false,
);
Here is the definitive list of config settings you can add:
General #
appId #
Accepts A string
Default null
Since Craft 2.2
The application ID, which is used for things like storing data caches and user s
essions. If it s not set, Craft will automatically generate one based on the serve
r path. Setting it will help avoid the loss of data caches and user sessions whe
n Craft is deployed using a deployment script that will store Craft in an incons
istent location, such as Capistrano.
'appId' => 'lannister',
cacheDuration #
Accepts A string set to any valid PHP interval specification, or false if you wi
sh to cache data indefinitely.
Default 'P1D' (one day)
Since Craft 1.0
The length of time Craft will store data caches. Also used by the {% cache %} te
mplate tag if no expiration time is specified as a parameter.
'cacheDuration' => 'P1W',
cacheMethod #
Accepts 'apc', 'db', 'eaccelerator', 'file', 'memcache', 'redis', 'wincache', 'x
cache', or 'zenddata'
Default 'file'
Since Craft 2.0
The method Craft will use to store data caches.
'cacheMethod' => 'memcache',
Note that this config setting has no effect on the {% cache %} template tag, whi
ch always stores its data in the database.
The DB, file, Memcache(d), and Redis cache methods each have their own additiona
l config settings, which must be set in separate config files in the craft/confi
g/ folder (dbcache.php, filecache.php, memcache.php and rediscache.php, respecti
vely). You can find their default values in craft/app/etc/config/defaults/.
customAsciiCharMappings #
Accepts An array of key/value pairs mapping character codes to lower ASCII strin
gs
Default array() (an empty array)

Since Craft 1.0


Any custom ASCII character mappings.
This array is merged into the default mapping array in StringHelper::getAsciiCha
rMap().
The keys should be the HTML decimal code equivalent of the character to search f
or and the value is the ASCII character used for swapping.
For example, the code for is 198. See sites like http://character-code.com/ to l
ook up additional codes.
'customAsciiCharMappings' => array(
198 => 'AE',
216 => 'O',
197 => 'A',
),
defaultCookieDomain #
Accepts A string
Default ''
Since Craft 2.2
The default domain name Craft will use when sending cookies to the browser. If i
t is left blank, Craft will leave it up to the browser to decide
which will be w
hatever the current request s domain name is.
'defaultCookieDomain' => '.example.com',
defaultSearchTermOptions #
Accepts An array of key/value pairs
Default array('attribute' => null, 'exact' => false, 'exclude' => false, 'subLef
t' => false, 'subRight' => false)
Since Craft 2.5
The default options Craft will apply to all search terms when searching for elem
ents.
The array can contain the following keys;
attribute (string) The element attribute the search term should apply to (e.g. '
title'). (Overridden if the search term in the actual query begins with someAttr
ibute:.)
exact (boolean)
Whether the search term should be an exact match to the attribut
e s value. (Only applicable when attribute is set, or the search term in the actua
l query begins with someAttribute:.)
exclude (boolean)
Whether the search results should exclude results where the se
arch term is a match.
subLeft (boolean) Whether to accept partial matches on keywords that have additi
onal characters before the search term.
subRight (boolean) Whether to accept partial matches on keywords that have addit
ional characters after the search term.
'defaultSearchTermOptions' => array(
'subLeft' => true,
'subRight' => true,
),
devMode #
Accepts true or false
Default false
Since Craft 1.0
Determines whether the system is in Dev Mode or not. (See What Dev Mode Does for

more info.)
'devMode' => true,
Dev Mode should never be enabled in production environments.
defaultWeekStartDay #
Accepts A number from 0 to 6 (where 0 represents Sunday and 6 represents Saturda
y)
Default 0 (Sunday)
Since Craft 2.5
The number representing the default Week Start Day preference value for new user
s.
environmentVariables #
Accepts An array of key/value string pairs
Default array() (an empty array)
Since Craft 1.1
An array of environment-specific variables which can be accessed as tags within
URL and Path settings. (See Multi-Environment Configs for more info.)
'environmentVariables' => array(
'baseAssetUrl' => '//example.com/',
'baseAssetPath' => './',
),
isSystemOn #
Accepts true, false, or null
Default null
Since Craft 2.1
Overrides the System Status

setting in Settings ? General if set to true or false.

'isSystemOn' => false,


logDumpMethod #
Accepts A valid method name, callable, or function.
Default 'var_export'
Since Craft 2.3
A callable or function which will be used to dump context information. This sett
ing will get passed directly to CLogFilter::$dumper.
'logDumpMethod' => 'print_r',
overridePhpSessionLocation #
Accepts true, false, 'auto', or the path to a custom session save path
Default false
Since Craft 1.0
Determines whether Craft should override PHP s session storage location to your cr
aft/storage/ folder, or save session files in a custom location.
When set to true, Craft will override the location; false will tell Craft to lea
ve the location alone and let PHP store the session where it was configured to.
When set to 'auto', Craft will check the default session location to see if it c
ontains :// , indicating that it might be stored with Memcache or the like. If it d
oes, Craft will leave it alone; otherwise Craft will override it.
'overridePhpSessionLocation' => 'tcp://127.0.0.1:1234',
If you are saving PHP session files to a custom location using memcache (or some
thing similar), you still need to tell PHP about it from Craft s index.php in your

public HTML folder.


ini_set('session.save_handler', 'memcached');
phpMaxMemoryLimit #
Accepts An integer setting the number of bytes, or a string set to a valid PHP s
horthand byte value
Default '256M' (256 MB)
Since Craft 1.0
The maximum amount of memory Craft will try to reserve during memory intensive o
perations such as zipping, unzipping and updating.
'phpMaxMemoryLimit' => '512M',
phpSessionName #
Accepts A string of alphanumeric characters
Default 'CraftSessionId'
Since Craft 2.4
The name of the PHP session cookie Craft will use. (This value will get passed t
o session_name()).
'phpSessionName' => 'PHPSESSID',
runTasksAutomatically #
Accepts true or false
Default true
Since Craft 2.3.2632
Whether Craft should run pending background tasks automatically over HTTP reques
ts, or leave it up to something like a Cron job to call index.php/actions/tasks/
runPendingTasks at a regular interval.
This setting should be disabled for servers running Win32, or with Apache s mod_de
flate/mod_gzip installed, where PHP s flush() method won t work.
If disabled, an alternate task running trigger must be set up separately. For ex
ample, this Cron command would trigger a task runner once every minute:
*/1 * * * * /usr/bin/curl --silent --compressed http://example.com/index.php?p=a
ctions/tasks/runPendingTasks
searchIgnoreWords #
Accepts An array of words to ignore
Default array('the', 'and')
Since Craft 1.0
Words that should be ignored when indexing search keywords and preparing search
terms to be matched against the keyword index.
'searchIgnoreWords' => array('the', 'and', 'but'),
sendPoweredByHeader #
Accepts
Default
Since
Whether
t.

true or false
true
Craft 2.4
the X-Powered-By: Craft CMS header should be sent along with each reques

'sendPoweredByHeader' => false,


siteName #
Accepts A string, or an array that maps locale IDs to locale-specific strings.

Default null
Since Craft 2.3
Your site s name. If this is set, it will take precedence over the Site Name setti
ng in Settings ? General.
'siteName' => array(
'en' => 'On the Rocks',
'es' => 'Con Hielo'
),
siteUrl #
Accepts A string set to any valid URL, or an array that maps locale IDs to local
e-specific URLs
Default null
Since Craft 2.0
Your site s URL. If this is set, it will take precedence over the Site URL setting
in Settings ? General, as well as the CRAFT_SITE _URL constant, if set.
This is the recommended way to set the site URL on multi-lingual sites, as it gi
ves Craft a way of knowing the correct URLs it should point localized entries/ca
tegories to.
'siteUrl' => array(
'en' => 'http://example.com/',
'de' => 'http://example.de/'
),
timezone #
Accepts A string set to a valid PHP timezone.
Default null
Since Craft 2.3
The system timezone. If this is set, it will take precedence over the Timezone s
etting in Settings ? General.
'timezone' => 'America/Los_Angeles',
translationDebugOutput #
Accepts true or false
Default false
Since Craft 1.0
Tells Craft whether to surround all strings that are ran through Craft::t() or t
he |translate filter with @ symbols, to help find any strings that are not being t
ranslated.
'translationDebugOutput' => true,
useCompressedJs #
Accepts true or false
Default true
Since Craft 1.0
Tells Craft whether to use compressed Javascript files whenever possible, to cut
down on page load times.
'useCompressedJs' => false,
useWriteFileLock #
Accepts
Default
Since
Whether

true or false, or 'auto'


'auto'
Craft 2.0
to grab an exclusive lock on a file when writing to it by using the LOCK

_EX flag.
Some file systems, such as NFS, do not support exclusive file locking.
When set to 'auto', Craft will automatically try to detect if the underlying fil
e system supports exclusive file locking and cache the results.
'useWriteFileLock' => true,
useXSendFile #
Accepts
Default
Since
Whether

true or false
false
Craft 1.0
Craft should use XSendFile to serve files when possible.

'useXSendFile' => true,


Security #
csrfTokenName #
Accepts A string
Default 'CRAFT_CSRF_TOKEN'
Since Craft 2.2
The name that Craft should give CSRF cookies, and which getCsrfInput() will give
to the input it returns, if CSRF Protection is enabled.
'csrfTokenName' => 'CSRF',
defaultFilePermissions #
Accepts A valid PHP file permission mode
Default 0664
Since Craft 2.2
The permissions Craft will use when creating a new file on the file system.

Anda mungkin juga menyukai