05.06.2023 Have you read it yet 7854 once It helped to the readers

Time synchronization on the database server and the web server

When checking the connection to the 1C-Bitrix website from 1C:Integrated automation, revision 1.1 error occurs:

Authorization failed. The connection to the server could not be established. Check the username and password. Server response: failure. The time on the database server differs from the time on the web server by more than 10 minutes. The time zones are probably configured incorrectly. Complete the setup and repeat the exchange.The connection could not be established.

This error appears if the username and password are correct, but the time on the database server is not. To set the time, do the following:

1. Define your time zone. You can do this, for example, here: http://php.net/manual/en/timezones.php

In my case, it's "Asia/Novosibirsk".

2. Set the time zone for PHP. To do this, edit the file. /bitrix/php_interface/dbconn.php and add the following to it:

date_default_timezone_set("Asia/Novosibirsk");

3. Set the time zone for MySQL in the file /bitrix/php_interface/after_connect.php:

$DB->Query("SET LOCAL time_zone='".date('P')."'");	
In the file /bitrix/php_interface/after_connect_d7.php:
$connection->queryExecute('SET LOCAL time_zone="'.date('P').'"');

We will take the time zone from the PHP settings. Sometimes the system may not contain information about the cancellation of the transition to winter time in the Russian Federation. In this case, you can use a direct indication of the shift relative to GMT, for example, for Moscow it will be:

date_default_timezone_set("Etc/GMT-4");
$DB->Query("SET LOCAL time_zone='Etc/GMT-4'");


Feedback

Was the material useful?

The assessment helps to understand which materials are worth developing and supplementing.

Discuss the task

Ask for help

Describe the task and leave your contacts. I will look at the introductory notes and contact you in a convenient way.

Direction *