Merge pull request #10947 from JMAConsulting/CRM-21133
[civicrm-core.git] / templates / CRM / common / civicrm.settings.php.template
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27
28 /**
29 * CiviCRM Configuration File.
30 */
31
32 /**
33 * Content Management System (CMS) Host:
34 *
35 * CiviCRM can be hosted in either Drupal 6 or 7, Joomla or WordPress.
36 *
37 * Settings for Backdrop CMS:
38 * define( 'CIVICRM_UF' , 'Backdrop');
39 *
40 * Settings for Drupal 7.x:
41 * define( 'CIVICRM_UF' , 'Drupal');
42 *
43 * Settings for Drupal 6.x:
44 * define( 'CIVICRM_UF' , 'Drupal6');
45 *
46 * Settings for Joomla 1.7.x - 2.5.x:
47 * define( 'CIVICRM_UF' , 'Joomla');
48 *
49 * Settings for WordPress 3.3.x:
50 * define( 'CIVICRM_UF' , 'WordPress');
51 *
52 * You may have issues with images in CiviCRM. If this is the case, be sure
53 * to update the CiviCRM Resource URL field to your CiviCRM root directory
54 * (Administer::System Settings::Resource URLs).
55 */
56 if (!defined('CIVICRM_UF')) {
57 if (getenv('CIVICRM_UF')) {
58 define('CIVICRM_UF', getenv('CIVICRM_UF'));
59 }
60 else {
61 define('CIVICRM_UF', '%%cms%%');
62 }
63 }
64
65 /**
66 * Content Management System (CMS) Datasource:
67 *
68 * Update this setting with your CMS (Drupal, Backdrop CMS, or Joomla) database username, password, server and DB name.
69 * If any of these contain a single quote or backslash, escape those characters with a backslash: \' and \\, respectively.
70 *
71 * Datasource (DSN) format:
72 * define( 'CIVICRM_UF_DSN', 'mysql://cms_db_username:cms_db_password@db_server/cms_database?new_link=true');
73 */
74 if (!defined('CIVICRM_UF_DSN') && CIVICRM_UF !== 'UnitTests') {
75 define( 'CIVICRM_UF_DSN' , 'mysql://%%CMSdbUser%%:%%CMSdbPass%%@%%CMSdbHost%%/%%CMSdbName%%?new_link=true');
76 }
77
78 /**
79 * CiviCRM Database Settings
80 *
81 * Database URL (CIVICRM_DSN) for CiviCRM Data:
82 * Database URL format:
83 * define( 'CIVICRM_DSN', 'mysql://crm_db_username:crm_db_password@db_server/crm_database?new_link=true');
84 *
85 * Drupal and CiviCRM can share the same database, or can be installed into separate databases.
86 * Backdrop CMS and CiviCRM can also share the same database, or can be installed into separate databases.
87 *
88 * EXAMPLE: Drupal/Backdrop and CiviCRM running in the same database...
89 * DB Name = cms, DB User = cms
90 * define( 'CIVICRM_DSN' , 'mysql://cms:YOUR_PASSWORD@localhost/cms?new_link=true');
91 *
92 * EXAMPLE: Drupal/Backdrop and CiviCRM running in separate databases...
93 * CMS DB Name = cms, DB User = cms
94 * CiviCRM DB Name = civicrm, CiviCRM DB User = civicrm
95 * define( 'CIVICRM_DSN' , 'mysql://civicrm:YOUR_PASSWORD@localhost/civicrm?new_link=true');
96 *
97 * If your username, password, server or DB name contain a single quote or backslash, escape those characters
98 * with a backslash: \' and \\, respectively.
99 *
100 */
101 if (!defined('CIVICRM_DSN')) {
102 if (CIVICRM_UF === 'UnitTests' && isset($GLOBALS['_CV']['TEST_DB_DSN'])) {
103 define('CIVICRM_DSN', $GLOBALS['_CV']['TEST_DB_DSN']);
104 }
105 else {
106 define('CIVICRM_DSN', 'mysql://%%dbUser%%:%%dbPass%%@%%dbHost%%/%%dbName%%?new_link=true');
107 }
108 }
109
110 /**
111 * CiviCRM DSN Mode
112 * Used to determine if you want CiviCRM to automatically change the dsn to mysqli if its avaliable.
113 * Uncomment and edit below as necessary
114 */
115 // define ('DB_DSN_MODE', 'auto');
116
117
118 /**
119 * CiviCRM Logging Database
120 *
121 * Used to point to a different database to use for logging (if desired). If unset defaults to equal CIVICRM_DSN.
122 * The CIVICRM_DSN user needs to have the rights to modify the below database schema and be able to write to it.
123 */
124 if (!defined('CIVICRM_LOGGING_DSN')) {
125 define('CIVICRM_LOGGING_DSN', CIVICRM_DSN);
126 }
127
128 /**
129 * File System Paths:
130 *
131 * $civicrm_root is the file system path on your server where the civicrm
132 * code is installed. Use an ABSOLUTE path (not a RELATIVE path) for this setting.
133 *
134 * CIVICRM_TEMPLATE_COMPILEDIR is the file system path where compiled templates are stored.
135 * These sub-directories and files are temporary caches and will be recreated automatically
136 * if deleted.
137 *
138 * IMPORTANT: The COMPILEDIR directory must exist,
139 * and your web server must have read/write access to these directories.
140 *
141 *
142 * EXAMPLE - Drupal:
143 * If the path to the Drupal home directory is /var/www/htdocs/drupal
144 * the $civicrm_root setting would be:
145 * $civicrm_root = '/var/www/htdocs/drupal/sites/all/modules/civicrm/';
146 *
147 * the CIVICRM_TEMPLATE_COMPILEDIR would be:
148 * define( 'CIVICRM_TEMPLATE_COMPILEDIR', '/var/www/htdocs/drupal/sites/default/files/civicrm/templates_c/');
149 *
150 * EXAMPLE - Backdrop CMS:
151 * If the path to the Backdrop home directory is /var/www/htdocs/backdrop
152 * the $civicrm_root setting would be:
153 * $civicrm_root = '/var/www/htdocs/backdrop/modules/civicrm/';
154 *
155 * the CIVICRM_TEMPLATE_COMPILEDIR would be:
156 * define( 'CIVICRM_TEMPLATE_COMPILEDIR', '/var/www/htdocs/backdrop/files/civicrm/templates_c/');
157 *
158 * EXAMPLE - Joomla Installations:
159 * If the path to the Joomla home directory is /var/www/htdocs/joomla
160 * the $civicrm_root setting would be:
161 * $civicrm_root = '/var/www/htdocs/joomla/administrator/components/com_civicrm/civicrm/';
162 *
163 * the CIVICRM_TEMPLATE_COMPILEDIR would be:
164 * define( 'CIVICRM_TEMPLATE_COMPILEDIR', '/var/www/htdocs/joomla/media/civicrm/templates_c/');
165 *
166 * EXAMPLE - WordPress Installations:
167 * If the path to the WordPress home directory is /var/www/htdocs/wordpress and the path to the plugin directory is /var/www/htdocs/wordpress/wp-content/plugins
168 * the $civicrm_root setting would be:
169 * $civicrm_root = '/var/www/htdocs/wordpress/wp-content/plugins/civicrm/civicrm/';
170 *
171 * the CIVICRM_TEMPLATE_COMPILEDIR would be:
172 * define( 'CIVICRM_TEMPLATE_COMPILEDIR', '/var/www/htdocs/wordpress/wp-content/uploads/civicrm/templates_c/');
173 *
174 */
175
176 global $civicrm_root;
177
178 $civicrm_root = '%%crmRoot%%';
179 if (!defined('CIVICRM_TEMPLATE_COMPILEDIR')) {
180 define( 'CIVICRM_TEMPLATE_COMPILEDIR', '%%templateCompileDir%%');
181 }
182
183 /**
184 * Site URLs:
185 *
186 * This section defines absolute and relative URLs to access the host CMS (Backdrop, Drupal, or Joomla) resources.
187 *
188 * IMPORTANT: Trailing slashes should be used on all URL settings.
189 *
190 *
191 * EXAMPLE - Drupal Installations:
192 * If your site's home url is http://www.example.com/drupal/
193 * these variables would be set as below. Modify as needed for your install.
194 *
195 * CIVICRM_UF_BASEURL - home URL for your site:
196 * define( 'CIVICRM_UF_BASEURL' , 'http://www.example.com/drupal/');
197 *
198 * EXAMPLE - Backdrop CMS Installations:
199 * If your site's home url is http://www.example.com/backdrop/
200 * these variables would be set as below. Modify as needed for your install.
201 *
202 * CIVICRM_UF_BASEURL - home URL for your site:
203 * define( 'CIVICRM_UF_BASEURL' , 'http://www.example.com/backdrop/');
204 *
205 * EXAMPLE - Joomla Installations:
206 * If your site's home url is http://www.example.com/joomla/
207 *
208 * CIVICRM_UF_BASEURL - home URL for your site:
209 * Administration site:
210 * define( 'CIVICRM_UF_BASEURL' , 'http://www.example.com/joomla/administrator/');
211 * Front-end site:
212 * define( 'CIVICRM_UF_BASEURL' , 'http://www.example.com/joomla/');
213 *
214 */
215 if (!defined('CIVICRM_UF_BASEURL')) {
216 define( 'CIVICRM_UF_BASEURL' , '%%baseURL%%');
217 }
218
219 /**
220 * Define any CiviCRM Settings Overrides per http://wiki.civicrm.org/confluence/display/CRMDOC/Override+CiviCRM+Settings
221 *
222 * Uncomment and edit the below as appropriate.
223 */
224 // Add this line only once above any settings overrides.
225 // global $civicrm_setting;
226
227 // Override the Temporary Files directory.
228 // $civicrm_setting['Directory Preferences']['uploadDir'] = '/path/to/upload-dir' ;
229
230 // Override the custom files upload directory.
231 // $civicrm_setting['Directory Preferences']['customFileUploadDir'] = '/path/to/custom-dir';
232
233 // Override the images directory.
234 // $civicrm_setting['Directory Preferences']['imageUploadDir'] = '/path/to/image-upload-dir' ;
235
236 // Override the custom templates directory.
237 // $civicrm_setting['Directory Preferences']['customTemplateDir'] = '/path/to/template-dir';
238
239 // Override the Custom php path directory.
240 // $civicrm_setting['Directory Preferences']['customPHPPathDir'] = '/path/to/custom-php-dir';
241
242 // Override the extensions directory.
243 // $civicrm_setting['Directory Preferences']['extensionsDir'] = '/path/to/extensions-dir';
244
245 // Override the resource url
246 // $civicrm_setting['URL Preferences']['userFrameworkResourceURL'] = 'http://example.com/example-resource-url/';
247
248 // Override the Image Upload URL (System Settings > Resource URLs)
249 // $civicrm_setting['URL Preferences']['imageUploadURL'] = 'http://example.com/example-image-upload-url';
250
251 // Override the Custom CiviCRM CSS URL
252 // $civicrm_setting['URL Preferences']['customCSSURL'] = 'http://example.com/example-css-url' ;
253
254 // Override the extensions resource URL
255 // $civicrm_setting['URL Preferences']['extensionsURL'] = 'http://example.com/pathtoextensiondir'
256
257 // Disable display of Community Messages on home dashboard
258 // $civicrm_setting['CiviCRM Preferences']['communityMessagesUrl'] = false;
259
260 // Disable automatic download / installation of extensions
261 // $civicrm_setting['Extension Preferences']['ext_repo_url'] = false;
262
263 // set triggers to be managed offline per CRM-18212
264 // $civicrm_setting['CiviCRM Preferences']['logging_no_trigger_permission'] = 1;
265
266 // Override the CMS root path defined by cmsRootPath.
267 // define('CIVICRM_CMSDIR', '/path/to/install/root/');
268
269 // Opt-out of announcements by the CiviCRM core team for releases, paid services, events, etc. Separate each preferred optout category with a comma:
270 // "offers": paid service offers
271 // "asks": requests for donations or membership signup/renewal to CiviCRM
272 // "releases": major release announcements
273 // "events": announcements of local/national upcoming events
274 // $civicrm_setting['CiviCRM Preferences']['communityMessagesUrl'] = 'https://alert.civicrm.org/alert?prot=1&ver={ver}&uf={uf}&sid={sid}&lang={lang}&co={co}&optout=offers,asks';
275
276
277 /**
278 * If you are using any CiviCRM script in the bin directory that
279 * requires authentication, then you also need to set this key.
280 * We recommend using a 16-32 bit alphanumeric/punctuation key.
281 * More info at http://wiki.civicrm.org/confluence/display/CRMDOC/Command-line+Script+Configuration
282 */
283 if (!defined('CIVICRM_SITE_KEY')) {
284 define( 'CIVICRM_SITE_KEY', '%%siteKey%%');
285 }
286
287 /**
288 * Enable this constant, if you want to send your email through the smarty
289 * templating engine(allows you to do conditional and more complex logic)
290 *
291 */
292 if (!defined('CIVICRM_MAIL_SMARTY')) {
293 define( 'CIVICRM_MAIL_SMARTY', 0 );
294 }
295
296 /**
297 * This setting logs all emails to a file. Useful for debugging any mail (or civimail) issues.
298 * Enabling this setting will not send any email, ensure this is commented out in production
299 * The CIVICRM_MAIL_LOG is a debug option which disables MTA (mail transport agent) interaction.
300 * You must disable CIVICRM_MAIL_LOG before CiviCRM will talk to your MTA.
301 */
302 // if (!defined('CIVICRM_MAIL_LOG')) {
303 // define( 'CIVICRM_MAIL_LOG', '%%templateCompileDir%%/mail.log');
304 // }
305
306
307 if (!defined('CIVICRM_DOMAIN_ID')) {
308 define( 'CIVICRM_DOMAIN_ID', 1);
309 }
310
311 /**
312 * Setting to define the environment in which this CiviCRM instance is running.
313 * Note the setting here must be value from the option group 'Environment',
314 * (see Administration > System Settings > Option Groups, Options beside Environment)
315 * which by default has three option values: 'Production', 'Staging', 'Development'.
316 * NB: defining a value from CIVICRM_ENVIRONMENT here prevents it from being set
317 * via the browser.
318 */
319
320 // define( 'CIVICRM_ENVIRONMENT', 'Production' );
321
322 /**
323 * Settings to enable external caching using a cache server. This is an
324 * advanced feature, and you should read and understand the documentation
325 * before you turn it on. We cannot store these settings in the DB since the
326 * config could potentially also be cached and we need to avoid an infinite
327 * recursion scenario.
328 *
329 * @see http://civicrm.org/node/126
330 */
331
332 /**
333 * If you have a cache server configured and want CiviCRM to make use of it,
334 * set the following constant. You should only set this once you have your cache
335 * server up and working, because CiviCRM will not start up if your server is
336 * unavailable on the host and port that you specify. By default CiviCRM will use
337 * an in-memory array cache
338 *
339 * To use the php extension memcache use a value of 'Memcache'
340 * To use the php extension memcached use a value of 'Memcached'
341 * To use the php extension apc use a value of 'APCcache'
342 * To use the php extension redis use a value of 'Redis'
343 * To not use any caching (not recommended), use a value of 'NoCache'
344 *
345 */
346 if (!defined('CIVICRM_DB_CACHE_CLASS')) {
347 define('CIVICRM_DB_CACHE_CLASS', 'ArrayCache');
348 }
349
350 /**
351 * Change this to the IP address of your cache server if it is not on the
352 * same machine (Unix).
353 */
354 if (!defined('CIVICRM_DB_CACHE_HOST')) {
355 define('CIVICRM_DB_CACHE_HOST', 'localhost');
356 }
357
358 /**
359 * Change this if you are not using the standard port for your cache server.
360 *
361 * The standard port for Memcache & APCCache is 11211. For Redis it is 6379.
362 */
363 if (!defined('CIVICRM_DB_CACHE_PORT')) {
364 define('CIVICRM_DB_CACHE_PORT', 11211 );
365 }
366
367 /**
368 * Change this if your cache server requires a password (currently only works
369 * with Redis)
370 */
371 if (!defined('CIVICRM_DB_CACHE_PASSWORD')) {
372 define('CIVICRM_DB_CACHE_PASSWORD', '' );
373 }
374
375 /**
376 * Items in cache will expire after the number of seconds specified here.
377 * Default value is 3600 (i.e., after an hour)
378 */
379 if (!defined('CIVICRM_DB_CACHE_TIMEOUT')) {
380 define('CIVICRM_DB_CACHE_TIMEOUT', 3600 );
381 }
382
383 /**
384 * If you are sharing the same cache instance with more than one CiviCRM
385 * database, you will need to set a different value for the following argument
386 * so that each copy of CiviCRM will not interfere with other copies. If you only
387 * have one copy of CiviCRM, you may leave this set to ''. A good value for
388 * this if you have two servers might be 'server1_' for the first server, and
389 * 'server2_' for the second server.
390 */
391 if (!defined('CIVICRM_DB_CACHE_PREFIX')) {
392 define('CIVICRM_DB_CACHE_PREFIX', '');
393 }
394
395 /**
396 * If you have multilingual site and you are using the "inherit CMS language"
397 * configuration option, but wish to, for example, use fr_CA instead of the
398 * default fr_FR (for French), set one or more of the constants below to an
399 * appropriate regional value.
400 */
401 // define('CIVICRM_LANGUAGE_MAPPING_FR', 'fr_CA');
402 // define('CIVICRM_LANGUAGE_MAPPING_EN', 'en_CA');
403 // define('CIVICRM_LANGUAGE_MAPPING_ES', 'es_MX');
404 // define('CIVICRM_LANGUAGE_MAPPING_PT', 'pt_BR');
405 // define('CIVICRM_LANGUAGE_MAPPING_ZH', 'zh_TW');
406
407 /**
408 * Native gettext improves performance of localized CiviCRM installations
409 * significantly. However, your host must enable the locale (language).
410 * On most GNU/Linux, Unix or MacOSX systems, you may view them with
411 * the command line by typing: "locale -a".
412 *
413 * On Debian or Ubuntu, you may reconfigure locales with:
414 * # dpkg-reconfigure locales
415 *
416 * For more information:
417 * http://wiki.civicrm.org/confluence/x/YABFBQ
418 */
419 // if (!defined('CIVICRM_GETTEXT_NATIVE')) {
420 // define('CIVICRM_GETTEXT_NATIVE', 1);
421 // }
422
423 /**
424 * Configure MySQL to throw more errors when encountering unusual SQL expressions.
425 *
426 * If undefined, the value is determined automatically. For CiviCRM tarballs, it defaults
427 * to FALSE; for SVN checkouts, it defaults to TRUE.
428 */
429 // if (!defined('CIVICRM_MYSQL_STRICT')) {
430 // define('CIVICRM_MYSQL_STRICT', TRUE );
431 // }
432
433 if (CIVICRM_UF === 'UnitTests') {
434 if (!defined('CIVICRM_CONTAINER_CACHE')) define('CIVICRM_CONTAINER_CACHE', 'auto');
435 if (!defined('CIVICRM_MYSQL_STRICT')) define('CIVICRM_MYSQL_STRICT', true);
436 }
437
438 /**
439 *
440 * Do not change anything below this line. Keep as is
441 *
442 */
443
444 $include_path = '.' . PATH_SEPARATOR .
445 $civicrm_root . PATH_SEPARATOR .
446 $civicrm_root . DIRECTORY_SEPARATOR . 'packages' . PATH_SEPARATOR .
447 get_include_path( );
448 if ( set_include_path( $include_path ) === false ) {
449 echo "Could not set the include path<p>";
450 exit( );
451 }
452
453 if (!defined('CIVICRM_CLEANURL')) {
454 if ( function_exists('variable_get') && variable_get('clean_url', '0') != '0') {
455 define('CIVICRM_CLEANURL', 1 );
456 }
457 else {
458 define('CIVICRM_CLEANURL', 0);
459 }
460 }
461
462 // force PHP to auto-detect Mac line endings
463 ini_set('auto_detect_line_endings', '1');
464
465 // make sure the memory_limit is at least 64 MB
466 $memLimitString = trim(ini_get('memory_limit'));
467 $memLimitUnit = strtolower(substr($memLimitString, -1));
468 $memLimit = (int) $memLimitString;
469 switch ($memLimitUnit) {
470 case 'g': $memLimit *= 1024;
471 case 'm': $memLimit *= 1024;
472 case 'k': $memLimit *= 1024;
473 }
474 if ($memLimit >= 0 and $memLimit < 134217728) {
475 ini_set('memory_limit', '128M');
476 }
477
478 require_once 'CRM/Core/ClassLoader.php';
479 CRM_Core_ClassLoader::singleton()->register();