frontend\controllers\SiteController not declared on cpanel

Sorry for my english before,

I’ve some problem when i move my yii2 project to real server (Cpanel v0.9.8 with PHP 5.6.31).

My project working correctly on localhost (XAMPP v3.2.2 with PHP 7.0.18), but my project cannot runing on real server and always displaying this error :

An Error occurred while handling another error:

exception ‘yii\base\InvalidRouteException’ with message ‘Unable to resolve the request “site/error”.’ in /home/my_real_server/public_html/

Stack trace:

#0 /home/my_real_server/public_html/ yii\base\Module->runAction(‘site/error’)

#1 /home/my_real_server/public_html/ yii\web\ErrorHandler->renderException(Object(yii\web\NotFoundHttpException))

#2 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\NotFoundHttpException))

#3 {main}

Previous exception:

exception ‘yii\base\InvalidRouteException’ with message ‘Unable to resolve the request “”.’ in /home/my_real_server/public_html/

Stack trace:

#0 /home/my_real_server/public_html/ yii\base\Module->runAction(’’, Array)

#1 /home/my_real_server/public_html/ yii\web\Application->handleRequest(Object(yii\web\Request))

#2 /home/my_real_server/public_html/ yii\base\Application->run()

#3 {main}

Next exception ‘yii\web\NotFoundHttpException’ with message ‘Halaman tidak ditemukan.’ in /home/my_real_server/public_html/

Stack trace:

#0 /home/my_real_server/public_html/ yii\web\Application->handleRequest(Object(yii\web\Request))

#1 /home/my_real_server/public_html/ yii\base\Application->run()

#2 {main}

i’ve searching for fix this error but i cannot find the right solusion for my problem.

i’ve open the file under vendor/yiisoft/yii2/base/Module.php on line 522 :

$parts = $this->createController($route);

the "createController()" function is return NULL on real server but return controller object on my localhost.

so i search for further this function and i found this function declared on the same file on line 618,

i found this block code on line 638 :

if (strpos($className, ‘-’) !== false || !class_exists($className)) {

return null;


the $className variable filled with string "frontend\controllers\SiteController" and checked by "class_exists()" function and return FALSE (WHY ?).

this not happened on my localhost (return is TRUE !).

so i check again for this issue with this code : (i insert after line 637 code)

echo "<pre>";


echo "</pre>";


and this is the return value from my localhost :

[191] => yii\base\Response

[192] => yii\web\Response

[193] => yii\base\Controller

[194] => yii\web\Controller

[195] => frontend\controllers\SiteController

i cannot find my SiteController with this function on my real server. (in other word, my SiteController is not declared on my real server)

please help me find where is the problem happened on my server and what solution should i do

Did you check file name? (case sensitive)

my filename is SiteController.php under public_html/

namespace is frontend\controllers

Before proceeding, you should properly place your folders correctly: See my reply here

Main yii2 should not be exposed to public.

You may want to check the aliases. Because of the move to a different environment, the directories may be different.