M
M
Mechanic2020-05-21 19:00:40
PHP
Mechanic, 2020-05-21 19:00:40

Why is the kernel (prolog_before.php) not connected when calling the script via cron?

When running the script by cron, $_SERVER['DOCUMENT_ROOT'] is empty, but redefinition and/or absolute paths for connecting the prologue do not help. At the same time, the script works correctly in the browser window. What could be the problem?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Kontrael, 2020-05-21
@bitrixweb

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Content-type: text/html; charset=utf-8");
header("Pragma: no-cache");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
define("NO_KEEP_STATISTIC", true);
define("NOT_CHECK_PERMISSIONS", true);

if (!$_SERVER["DOCUMENT_ROOT"]) {
    $_SERVER["DOCUMENT_ROOT"] = '/home/bitrix/www'; //тут укажите свой путь
}
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php");

X
xmoonlight, 2020-05-21
@xmoonlight

Web server - yes.
Web server - no.
:)

N
Nentra, 2021-10-15
@Nentra

This scribe killed me too - this ********* prologue stopped connecting

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question