P
P
Petr Ponomarev2016-11-18 21:01:05
Yii
Petr Ponomarev, 2016-11-18 21:01:05

Yii2 on vds, when going to the created pages, an uncnown class error occurs, what could be the problem?

I made a project on openServer, created models, views, everything works fine, transferred it to vds, this error appears there, and if you upload standard yii to the server without new pages, everything works, I have already checked all the paths 10 times, files are uploaded to the server by ftp, tell me please, what could be wrong?
The error is: Unknown Class - yii\base\UnknownClassException
Unable to find 'app\models\RegForm' in file: /var/www/yrich/data/www/boxpr.ru/models/RegForm.php. Namespace missing?
1. in /var/www/yrich/data/www/boxpr.ru/vendor/yiisoft/yii2/BaseYii.php at line 291
282283284285286287288289290291292293294295296297298299300 return;
}
} else {
return;
}
include($classFile);
if (YII_DEBUG && !class_exists($className, false) && !interface_exists($className, false) && !trait_exists($className, false)) {
throw new UnknownClassException("Unable to find '$className' in file: $classFile. namespace missing?");
}
}
/**
* Creates a new object using the given configuration.
*
* You may view this method as an enhanced version of the `new` operator.
* The method supports creating an object based on a class name, a configuration array or
* an anonymous function.
2. yii\BaseYii::autoload('app\models\RegForm')
3. in /var/www/yrich/data/www/boxpr.ru/controllers/SiteController.php at line 49 – spl_autoload_call('app\models\RegForm')
43444546474849505152535455 {
return $this->render('about') ;
}
public function actionReg()
{
$model = new RegForm();
return $this->render(
'reg',
['model' => $model]
);
}
4. app\controllers\SiteController::actionReg()
5. in /var/www/yrich/data/www/boxpr.ru/vendor/yiisoft/yii2/base/InlineAction.php at line 55 – call_user_func_array([app \controllers\SiteController, 'actionReg'], [])
6. in /var/www/yrich/data/www/boxpr.ru/vendor/yiisoft/yii2/base/Controller.php at line 154 – yii\base\InlineAction::runWithParams([])
7. in /var /www/yrich/data/www/boxpr.ru/vendor/yiisoft/yii2/base/Module.php at line 454 – yii\base\Controller::runAction('reg', [])
8. in /var/ www/yrich/data/www/boxpr.ru/vendor/yiisoft/yii2/web/Application.php at line 100 – yii\base\Module::runAction('site/reg', [])
9. in /var /www/yrich/data/www/boxpr.ru/vendor/yiisoft/yii2/base/Application.php at line 375 – yii\web\Application::handleRequest(yii\web\Request)
10. in /var/www /yrich/data/www/boxpr.ru/web/index.php at line 12 - yii\base\Application::run()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2016-11-18
@Petrdis

1. apparently does not exist /var/www/yrich/data/www/boxpr.ru/models/RegForm.php
2. an error in the namespace
This is actually what the error says. Have you checked?
ps: vds, vps or sharedhosting doesn't matter. But the server configuration and OS have. So for example on debian there are glitches with namespace. It is treated by killing this miserable OS or renaming the models folder, but in the second case, you will have to fix a lot in the namespace.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question