Yii2 advanced on a shared hosting

I just uploaded my yii2 advanced app on shared hosting environment but I get an error:

PHP Fatal error: require(): Failed opening required ‘/home2/XXXXX/public_html/vendor/autoload.php’ (include_path=’.:/usr/php/54/usr/lib64:/usr/php/54/usr/share/pear’) in /home2/XXXXX/public_html/index.php on line 5

index.php




<?php

defined('YII_DEBUG') or define('YII_DEBUG', false);

defined('YII_ENV') or define('YII_ENV', 'prod');


require(__DIR__ . '/vendor/autoload.php');

require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php');

require(__DIR__ . '/common/config/bootstrap.php');

require(__DIR__ . '/config/bootstrap.php');


$config = yii\helpers\ArrayHelper::merge(

    require(__DIR__ . '/common/config/main.php'),

    require(__DIR__ . '/common/config/main-local.php'),

    require(__DIR__ . '/config/main.php'),

    require(__DIR__ . '/config/main-local.php')

);


$application = new yii\web\Application($config);

$application->run();



kindly check vendor/autoload.php is uploaded or not.

I just followed the guide in

http://www.yiiframework.com/doc-2.0/guide-tutorial-shared-hosting.html

And uploaded the files in root folder.

/home2/xxxx

backend

frontend

vendor

/home2/xxxx/public_html/

index.php

etc.

require(): Failed opening required ‘/home2/xxxx/public_html/vendor/autoload.php’

the vendor and the other files are in /home2/xxxx

not in public_html

Thanks

u need to change here.

require(DIR . ‘/../../../vendor/autoload.php’);

require(DIR . ‘/../../../vendor/yiisoft/yii2/Yii.php’);

Now I have:

require(): Failed opening required ‘/home2/xxxx/public_html/../../../vendor/autoload.php’

It’s maybe path alias error!

Now I get:

PHP Fatal error: require(): Failed opening required ‘/home2/xxxx/public_html/../config/bootstrap.php’

the other three works fine:




require(__DIR__ . '/../../vendor/autoload.php');

require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');

require(__DIR__ . '/../../common/config/bootstrap.php');



These are the full config thats working for me.

I think we need a full tutorial and step by step on this subject.

How to upload an Yii2 application on a shared web hosting environment.




<?php

defined('YII_DEBUG') or define('YII_DEBUG', false);

defined('YII_ENV') or define('YII_ENV', 'prod');


require(__DIR__ . '/../../vendor/autoload.php');

require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');

require(__DIR__ . '/../../common/config/bootstrap.php');

require(__DIR__ . '/../../frontend/config/bootstrap.php');


$config = yii\helpers\ArrayHelper::merge(

    require(__DIR__ . '/../../common/config/main.php'),

    require(__DIR__ . '/../../common/config/main-local.php'),

    require(__DIR__ . '/../../frontend/config/main.php'),

    require(__DIR__ . '/../../frontend/config/main-local.php')

);


$application = new yii\web\Application($config);

$application->run();