hajdar
(Hajdardushku)
May 26, 2015, 8:18am
1
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();
hajdar:
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.
hajdar
(Hajdardushku)
May 26, 2015, 8:43am
3
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
hajdar:
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’);
hajdar
(Hajdardushku)
May 26, 2015, 1:33pm
5
Now I have:
require(): Failed opening required ‘/home2/xxxx/public_html/../../../vendor/autoload.php’
It’s maybe path alias error!
hajdar
(Hajdardushku)
May 27, 2015, 11:47am
6
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');
hajdar
(Hajdardushku)
May 28, 2015, 7:27am
7
hajdar:
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();