Y
Y
Yuri Voronin2019-08-07 11:39:15
1C-Bitrix
Yuri Voronin, 2019-08-07 11:39:15

How to fix errors while executing php script?

I am uploading product properties and fields from xml to Bitrix .
I have xml with files that need to be synchronized

<xml>
    <Files>
        <File href="/home/bitrix/ext_www/optguru.ru/upload/exchange_product/exchangeProductSku_1.xml"/>
        <File href="/home/bitrix/ext_www/optguru.ru/upload/exchange_product/exchangeProductSku_2.xml"/>
        ...
        <File href="/home/bitrix/ext_www/optguru.ru/upload/exchange_product/exchangeProductSku_8.xml"/>
        <File href="/home/bitrix/ext_www/optguru.ru/upload/exchange_product/exchangeProductSku_9.xml"/>
    </Files>
</xml>

Example xml for one product:
<Product>
            <Fields>
                <Field name="IBLOCK_ID">
                    <Value value="10"/>
                </Field>
                ...
                <Field name="DETAIL_PICTURE">
                    <Value value="/home/bitrix/ext_www/somebox.ru/upload/iblock/848/848f0af4929ee54080c9385cb4c1e764.jpg"/>
                </Field>
            </Fields>
            <Properties>
                <Property name="Цвет" property_type="S" multiply="N">
                    <Value value="black"/>
                </Property>
                <Property name="Картинки" property_type="F" multiply="Y">
                    <Value value="/home/bitrix/ext_www/somebox.ru/upload/iblock/656/656a385443ce96a1479fd8955f426b34.jpg"/>
                    <Value value="/home/bitrix/ext_www/somebox.ru/upload/iblock/d5e/d5e25ed1c4872e1dad379c2e08d7bee5.jpg"/>
                </Property>
            </Properties>
        </Product>

I don’t know if it’s worth posting the entire php script, if necessary, I’ll post it.
Fields I update
$el = new CIBlockElement;
$res = $el->Update($PRODUCT_ID, $fields);

Properties update:
CIBlockElement::SetPropertyValuesEx($PRODUCT_ID, CATALOG_SKU_IBLOCK, $properties);

I use XMLReader to work with xml .
When I run the script, I get errors :
[[email protected] ~]$ /usr/bin/php /home/bitrix/ext_www/optguru.ru/include/tools/exchangeProductIn.php
PHP Fatal error:  require_once(): Failed opening required '/home/bitrix/ext_www/optguru.ru/bitrix/modules/main/include/epilog_after.php' (include_path='.:/usr/share/pear:/usr/share/php') in /home/bitrix/ext_www/optguru.ru/include/tools/exchangeProductIn.php on line 249
PHP Stack trace:
PHP   1. {main}() /home/bitrix/ext_www/optguru.ru/include/tools/exchangeProductIn.php:0
PHP Fatal error:  require_once(): Failed opening required '/home/bitrix/ext_www/optguru.ru/bitrix/modules/main/lib/diag/exceptionhandlerlog.php' (include_path='.:/usr/share/pear:/usr/share/php') in /home/bitrix/ext_www/optguru.ru/bitrix/modules/main/lib/loader.php on line 377
PHP Stack trace:
PHP   1. {main}() /home/bitrix/ext_www/optguru.ru/include/tools/exchangeProductIn.php:0
PHP   2. Bitrix\Main\Diag\ExceptionHandler->handleFatalError() /home/bitrix/ext_www/optguru.ru/bitrix/modules/main/lib/diag/exceptionhandler.php:0
PHP   3. spl_autoload_call() /home/bitrix/ext_www/optguru.ru/bitrix/modules/main/lib/diag/exceptionhandler.php:350
PHP   4. Bitrix\Main\Loader::autoLoad() /home/bitrix/ext_www/optguru.ru/bitrix/modules/main/lib/diag/exceptionhandler.php:350

Fatal error: require_once(): Failed opening required '/home/bitrix/ext_www/optguru.ru/bitrix/modules/main/include/epilog_after.php' (include_path='.:/usr/share/pear:/usr/share/php') in /home/bitrix/ext_www/optguru.ru/include/tools/exchangeProductIn.php on line 249

Call Stack:
    0.0005     399480   1. {main}() /home/bitrix/ext_www/optguru.ru/include/tools/exchangeProductIn.php:0


Fatal error: require_once(): Failed opening required '/home/bitrix/ext_www/optguru.ru/bitrix/modules/main/lib/diag/exceptionhandlerlog.php' (include_path='.:/usr/share/pear:/usr/share/php') in /home/bitrix/ext_www/optguru.ru/bitrix/modules/main/lib/loader.php on line 377

Call Stack:
    0.0005     399480   1. {main}() /home/bitrix/ext_www/optguru.ru/include/tools/exchangeProductIn.php:0
 1211.3847  147692632   2. Bitrix\Main\Diag\ExceptionHandler->handleFatalError() /home/bitrix/ext_www/optguru.ru/bitrix/modules/main/lib/diag/exceptionhandler.php:0
 1211.3847  147694944   3. spl_autoload_call() /home/bitrix/ext_www/optguru.ru/bitrix/modules/main/lib/diag/exceptionhandler.php:350
 1211.3847  147695064   4. Bitrix\Main\Loader::autoLoad() /home/bitrix/ext_www/optguru.ru/bitrix/modules/main/lib/diag/exceptionhandler.php:350

I can't understand why this is happening. The most incomprehensible thing is why when I try to process each file separately - everything is fine, when all at once - errors.

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
Y
Yuri Voronin, 2019-08-08
@yuraSco

Could it be because there is not enough memory?

A
Alexander Akulenko, 2020-02-18
@akula410

Perhaps you need to specify the absolute path to the scripts when connecting

require_once __DIR__ .'/home/bitrix/ext_www/optguru.ru/bitrix/modules/main/include/epilog_after.php';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question