Answer the question
In order to leave comments, you need to log in
How to correctly run the script from under cron in Bitrix24 if $_SERVER["DOCUMENT_ROOT"] is used there?
In general, I wrote an application that connects
require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';
, but the fact is that it doesn’t work from under cron $_SERVER
... You can, of course, register __DIR__
, but then it will work only once, but in the prolog_before.php file there is also an include.php module require
, where there is a huge amount of require , even if I I change it there, then the first time Bitrix is updated, everything will fly off.
How to solve the problem?
cron log:$_SERVER["DOCUMENT_ROOT"]
PHP Fatal error: require(): Failed opening required '/bitrix/modules/main/include/prolog_before.php' (include_path='.:/usr/share/pear:/usr/share/php') in /home/bitrix/ext_www/site.ru/hook/xmlCreator/xmlCreator.php on line 7
Fatal error: require(): Failed opening required '/bitrix/modules/main/include/prolog_before.php' (include_path='.:/usr/share/pear:/usr/share/php') in /home/bitrix/ext_www/site.ru/hook/xmlCreator/xmlCreator.php on line 7
Answer the question
In order to leave comments, you need to log in
Like this) At the very beginning of the script. Right after <?php
define("NO_KEEP_STATISTIC", true);
define("NOT_CHECK_PERMISSIONS", true);
$_SERVER["DOCUMENT_ROOT"] = "/home/bitrix/www";
require_once($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question