Getting an ERROR in while doing code in PHP chdir function

php

#1

Warning: chdir(): No such file or directory (errno 2) in /home/ubuntu/workspace/lib/Template.php on line 29 Call Stack: 0.0009 235816 1. {main}() /home/ubuntu/workspace/index.php:0 0.0030 259544 2. Template->__toString() /home/ubuntu/workspace/index.php:11 0.0030 260472 3. chdir() /home/ubuntu/workspace/lib/Template.php:29

    public function __toString(){
        extract($this->vars);
        chdir(dirname($this->template));
        
       ob_start();
        
        include basename($this->template);

        return ob_get_clean();
    }

I am getting above error from this function. It is running perfectly in my localhost but getting error in C9 . Can any one help me to get it work?


#2

try adding echo $this->template; and then check if the directory exists


#3

Thanks that solves he problem.

Actually the T of template folder was capital and I wrote it in small letter in code! Changed that to small letter and now it works fine!

Thanks for you quick reply and support.