1
votes

I am building my website with Yii2 advanced template. The URL is rewritten into

localhost:9001/projectyii/page/index/#/demo

(page is controller, index is action, /#/demo is just a route for AngularJS on frontend) Everything works fine on my localhost. When I upload it into my server, whenever if I hit the URL has prefix example.com/projectyii/, it will throw the following exception

ReflectionException

Class yii\web\urlManager does not exist

1. in /home/scott/public_html/projectyii/vendor/yiisoft/yii2/di/Container.php at line 415
406407408409410411412413414415416417418419420421422423424     * @return array the dependencies of the specified class.
     */
    protected function getDependencies($class)
    {
        if (isset($this->_reflections[$class])) {
            return [$this->_reflections[$class], $this->_dependencies[$class]];
        }

        $dependencies = [];
        $reflection = new ReflectionClass($class); // error here

I notice that there are some other websites that have been running on same server already (they are all using Yii 1.1.13) and they have been working without problem, such as

example.com/project1/
example.com/project2/

...

it's just failed just this new site in Yii2.

The setting is under of components on /frontend/config/main.php is

'urlManager' => [
            'class' => 'yii\web\urlManager',
            'baseUrl' => $baseUrl,
            'enablePrettyUrl' => true,
            'showScriptName' => false,

            'rules' => [],
        ]

The error told that it could not find the urlManager class, but the class does exist, the namespace is fine because I DO NOT modify anything on the vendors folder where contains that urlManager class. I do not understand what I am missing here. Any help is appreciated! Thanks

1
It should be yii\web\UrlManager - soju
The case sensitive on Linux. That is why it worked on Windows (localhost) and didn't run on my server. How silly I am. Thank soju - Telvin Nguyen

1 Answers

0
votes

Linux like other unix systems are case sensitive you should use:

'class' => 'yii\web\UrlManager', instead of urlManager