R
R
Ruslan Absalyamov2018-07-19 14:44:55
1C-Bitrix
Ruslan Absalyamov, 2018-07-19 14:44:55

Why is the composer not connected to Bitrix?

I can’t connect the composer to Bitrix in any way, I seem to have done everything as in this article https://dev.1c-bitrix.ru/community/webdev/user/137... But I get an error

Fatal error: require_once(): Failed opening required '/home/bitrix/www/vendor/autoload.php' (include_path='.:/usr/share/pear:/usr/share/php') in /home/bitrix/www/local/php_interface/init.php on line 3

I added composer.json to the root. The vendor directory has been added to the root. In the file /local/php_interface/init.php I wrote
require_once $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php';

But somehow it doesn’t work and I don’t understand why it doesn’t work, it seems that I correctly indicated the path

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kontrael, 2018-07-19
@rusline18

You do not find the /vendor/autoload.php file itself.
In general, the actions are correct. Perhaps the server is configured incorrectly or the $_SERVER['DOCUMENT_ROOT'] value is overwritten in init.php.
Check that the working directory of the site is on the server along the path "/home/bitrix/www"

A
Andrey Nikolaev, 2018-07-19
@gromdron

Are you sure the file exists?
Try to put not a bare require_once, but with a check

if ( file_exists($_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php') )
{
  require_once($_SERVER['DOCUMENT_ROOT'].'/vendor/autoload.php');
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question