Settings in a new core are made in the file /bitrix/.settings.php
. Let us remember that in the old core similar settings were made in the file \bitrix\php_interface\dbconn.php
. The file .settings.php
differs significantly from the former dbconn.php in terms of structure.
Parameters may be edited using the Configuration class (Bitrix\Main\Config\Configuration).
Note: Some sections of the setting file contain the read only parameter. This parameter means that these settings will not be amended through API.
Parameter description
Parameters that may be changed are described below:
Cache Section
Is responsible for caching settings and permits to set the caching method and its parameters.
'cache' => array (
'value' => array (
'type' => 'files',
),
'readonly' => false,
),
Parameter | Value |
type | The following can be set as values:
- memcache
- eaccelerator
- apc
- xcache
- files
- none
or indicate arrays with values:
- class_name - a class implementing ICacheEngine interface,
- required_file - an add-on file with a path starting from bitrix or local (if required),
- required_remote_file - an add-on file with an absolute path (if required).
|
|
Note: In addition to type there may be additional parameters if a specific caching class requires them.
Note: The
memcache settings may also be set in the file
/bitrix/.settings_extra.php
.
File example /bitrix/.settings_extra.php
|
<?php
return array (
'cache' => array(
'value' => array (
'type' => 'memcache',
'memcache' => array(
'host' => 'unix:///tmp/memcached.sock',
'port' => '0',
'sid' => $_SERVER["DOCUMENT_ROOT"]."#01"
),
),
),
);
?> |
Section exception_handling
Responsible for exception handling.
'exception_handling' => array (
'value' => array (
'debug' => false,
'handled_errors_types' => E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE,
'exception_errors_types' => E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_USER_WARNING & ~E_USER_NOTICE & ~E_COMPILE_WARNING,
'ignore_silence' => false,
'assertion_throws_exception' => true,
'assertion_error_type' => 256,
'log' => array (
'settings' => array (
'file' => 'bitrix/modules/error.log',
'log_size' => 1000000,
),
),
),
'readonly' => false,
),
Parameter | Value |
debug | The key is responsible for displaying an error on a browser page. Errors should be displayed only at the development or debugging stage. Otherwise, there is a potential risk of information disclosure. |
handled_errors_types | This key is intended for setting error types to be caught by the system (not ignored). |
exception_errors_types | The key sets error types for which the system gives an exception. |
ignore_silence | The key cancels action of the error management operator (@). |
log | The key sets error logging parameters. If there is no key, there will be no logging. If set as in the example:
'log' => array (
'settings' => array (
'file' => 'bitrix/modules/error.log',
'log_size' => 1000000,
),
),
the logging will be made into a file and its size will be limited.
If set in a general case, logging can be made to anywhere:
'log' => array(
'class_name' => 'MyLog', // custom log class, must extends ExceptionHandlerLog; can be omited, in this case default Diag\FileExceptionHandlerLog will be used
'extension' => 'MyLogExt', // php extension, is used only with 'class_name'
'required_file' => 'modules/mylog.module/mylog.php' // included file, is used only with 'class_name'
'settings' => array( // any settings for 'class_name'
),
),
|
|
Connections section
Database and other data source connection parameters. The class name and connection parameters are set.
'connections' => array (
'value' => array (
'default' => array (
'className' => '\\Bitrix\\Main\\DB\\MysqlConnection',
'host' => 'localhost:31006',
'database' => 'admin_bus',
'login' => 'admin_bus',
'password' => 'admin_bus',
'options' => 2,
),
),
'readonly' => true,
),
);
Attention: The
mysqli extension can be used starting from core version
14.5.2 and higher 'className' => '\\Bitrix\\Main\\DB\\MysqliConnection'.
Also, for this purpose,
mysqli extension can be installed via PHP. Additional checks for extension availability are not performed! Mysqli can be enabled separately for the old (
dbconn.php) and the new (
.settings.php) core.
Parameter | Value |
options | Checkboxes of persistent connection and deferred connection with the database. Example:
Connection::PERSISTENT == 1
Connection::DEFERRED == 2
Their combinations can be recorded via bit operations. Example 3 - both PERSISTENT and DEFERRED. |
handlersocket | The key specifies which connection must be used for read (read key). Connection must be created, where class, host and port are specified. The example of code above, 'read' parameter is specified with the handlersocket value. Below is the description for the handlersocket connection. |
className | Class name, that receives the result of handling the specific database type. |
host | host name, where the database is located; can be specified with the port |
database | database name |
login | database user login |
password | database user password |
|
Root section
General settings are located in the root section.
Parameter | Value |
disable_iconv | Restricts the use of iconv library. Equivalent of the BX_ICONV_DISABLE constant in the old core |
| |
|
Pull section
This section is specifically required only for hosting partners (for deployment automation). For the rest, its recommended to use the setup via administrative control panel interface.
'pull' => Array(
'value' => array(
'path_to_listener' => "http://#DOMAIN#/bitrix/sub/";,
'path_to_listener_secure' => "https://#DOMAIN#/bitrix/sub/";,
'path_to_modern_listener' => "http://#DOMAIN#/bitrix/sub/";,
'path_to_modern_listener_secure' => "https://#DOMAIN#/bitrix/sub/";,
'path_to_mobile_listener' => "http://#DOMAIN#:8893/bitrix/sub/";,
'path_to_mobile_listener_secure' => "https://#DOMAIN#:8894/bitrix/sub/";,
'path_to_websocket' => "ws://#DOMAIN#/bitrix/subws/",
'path_to_websocket_secure' => "wss://#DOMAIN#/bitrix/subws/",
'path_to_publish' => 'http://127.0.0.1:8895/bitrix/pub/',
'nginx_version' => '3',
'nginx_command_per_hit' => '100',
'nginx' => 'Y',
'nginx_headers' => 'N',
'push' => 'Y',
'websocket' => 'Y',
'signature_key' => '1111111111',
'signature_algo' => 'sha1',
'guest' => 'N',
),
),
Parameter | Value |
path_to_listener | path to connect to server (http) to receive commands |
path_to_listener_secure | path to connect to server (https) to receive commands |
path_to_modern_listener | path to connect to server for modern web browsers (http) to receive command |
path_to_modern_listener_secure | path to connect to server for modern browsers (https) to receive commands |
path_to_websocket | path to connect to server for modern browsers with socket support (http) to receive commands |
path_to_websocket_secure | path to connect to server for modern browsers with web-socket support (https) to receive commands |
path_to_publish | path to publish commands from the server |
path_to_publish_web | path to publish commands from the web browser (http) |
path_to_publish_web_secure | path to publish commands from the web browser (https) |
nginx_version | queue server version |
nginx_command_per_hit | number of channels to his which the same data will be sent per hit |
nginx | enables the queue server |
nginx_headers | allows to send special headers |
push | enables the queue server |
websocket | activates the web-sockets |
signature_key | secret signature key for messages |
signature_algo | signature encryption algorithm |
guest | enables module active status for guests |
enable_protobuf | enables new format for messages |
limit_max_payload | maximum size of a message in bytes |
limit_max_messages_per_request | maximum number of messages per hit |
limit_max_channels_per_request | maximum number of channels per hit |
|
Http_client_options section
This section specifies by default options for the Bitrix\Main\Web\HttpClient class.
Parameter | Value |
redirect | true by default, execute redirect |
redirectMax | maximum number of such redirects (by default: 5) |
waitResponse | if true - wait for response (by default), otherwise - return the response immediately |
socketTimeout | response timeout period in seconds (by default: 30) |
streamTimeout | stream timeout in seconds (by default: 60) |
version | version http - 1.0 or 1.1 (by default: 1.0) |
proxyHost / proxyPort / proxyUser / proxyPassword | parameter group to setup a proxy |
compress | if true, sends Accept-Encoding: gzip |
charset | encoding for the object body (is used in the header field for the Content-Type request for POST and PUT) |
disableSslVerification | if true, ssl certificates verification will not be performed |
|
Set example:
'http_client_options' =>
array (
'value' =>
array (
'redirect' => true,//execute redirects, if required
'redirectMax' => 10,//but not more than 10
'version' => '1.1'//work via the http 1.1 protocol
),
'readonly' => false,
),
You can check if your settings are correct as follows:
use Bitrix\Main\Config\Configuration;
print_r(Configuration::getValue("http_client_options"));
Your array should be displayed.