Answer the question
In order to leave comments, you need to log in
How to solve View not Found - yii\base\ViewNotFoundException?
Transferred the site to yii to the hosting, everything works except the admin module, I felt great on openserver, everything worked, after the transfer to the hosting the module stopped working, an error is displayed:
View not Found - yii\base\ViewNotFoundException
The view file does not exist: / home/electro1/public_html/site.ru/modules/admin/views/order/index.php
On the second screen, line 51 is highlighted in red, I could not fix it yet. The php requirements version does not swear.
Answer the question
In order to leave comments, you need to log in
Is the file itself?
Most likely you have a problem with file permissions, trust them
Judging by
/home/electro1/public_html/site.ru/modules/admin/views/order/index.php
site.ruyou have a beard in your config. Somewhere the domain is registered and not correct.
the controller complains about the missing view index.php file. Check for the existence of a file by path
/home/electro1/public_html/site.ru/modules/admin/views/order/index.php
Write a function.
...
use yii\base\ViewNotFoundException;
...
$path = Yii::getAlias('@web').'/order/index';
...
try {
// 1) тут пишите то что хотите проверить
$this->render($path, ['dataProvider' => $dataProvider]);
} catch (ViewNotFoundException $e) {
// 2) тут выводите "удобную" ошибку, чтобы не закрывать ошибкой 500 или той которая вылезает
$this->render('myerror');
}
...
Yii::getAlias('@frontend')
- what if the project is not in the folder frontend
??? return ...;
Either you get the view or myerror
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question