Yii Autoload Import Not Working

hi,

the importing of models, components in the config/main.php is not happening in the remote server. It was working fine in the localhost development system. When ran the YII REQUIREMENTs, everything is OK except warnings for APC and Memcache. The PHP version is the latest (5.4x ) and Apache server with Suphp.

Error shown:

  1. After logging in as demo/demo: include(User.php): failed to open stream: No such file or directory.

  2. if including UrlManager.php as a class in config/main.php: Cant open UrlManager in Yiibase line 427

It is not something related to Yii and I am sure it is about my server configuration, but I look forward to some help here.

Thanks in advance.

hi,

the importing of models, components in the config/main.php is not happening in the remote server. It was working fine in the localhost development system. When ran the YII REQUIREMENTs, everything is OK except warnings for APC and Memcache ( I have the same warnings in my localhost). The PHP version is the latest (5.4.24 ) and Apache server with server API CGI/fastCGI. Still I have not uploaded my files, but getting the result from the files generated by yiic. The only change I made in the config is to add the ‘UrlManager’ class in the configuration array components and adding the same file UrlManager.php in the components folder. Even the models are not getting autoloaded. I know my problem is unique as I could not find any similar problem reported when searched for a solution.

Error shown:

  1. After logging in as demo/demo: include(User.php): failed to open stream: No such file or directory.

  2. if including UrlManager.php the error shown is as follows:

[i]Warning: include(UrlManager.php): failed to open stream: No such file or directory in /home/mysite/framework/YiiBase.php on line 427

Warning: include(): Failed opening ‘UrlManager.php’ for inclusion color="#FF0000"[/color] in /home/mysite/framework/YiiBase.php on line 427

Warning: include(UrlManager.php): failed to open stream: No such file or directory in /home/mysite/framework/YiiBase.php on line 427

Warning: include(): Failed opening ‘UrlManager.php’ for inclusion color="#FF0000"[/color] in /home/mysite/framework/YiiBase.php on line 427

Fatal error: Class ‘UrlManager’ not found in /home/mysite/framework/YiiBase.php on line 217

[/i]

Following is the stack trace.

[i]PHP warning

include(UrlManager.php): failed to open stream: No such file or directory

/home/mysite/framework/YiiBase.php(427)

415 {

416 include($classFile);

417 if(YII_DEBUG && basename(realpath($classFile))!==$className.’.php’)

418 throw new CException(Yii::t(‘yii’,‘Class name “{class}” does not match class file “{file}”.’, array(

419 ‘{class}’=>$className,

420 ‘{file}’=>$classFile,

421 )));

422 break;

423 }

424 }

425 }

426 else

427 include($className.’.php’);

428 }

429 else // class name with namespace in PHP 5.3

430 {

431 $namespace=str_replace(’\\’,’.’,ltrim($className,’\\’));

432 if(($path=self::getPathOfAlias($namespace))!==false)

433 include($path.’.php’);

434 else

435 return false;

436 }

437 return class_exists($className,false) || interface_exists($className,false);

438 }

439 return true;

Stack Trace

#0 + /home/mysite/framework/YiiBase.php(427): YiiBase::autoload()

#1 + /home/mysite/framework/YiiBase.php(302): YiiBase::autoload("UrlManager")

#2 + /home/mysite/framework/YiiBase.php(196): YiiBase::import("UrlManager", true)

#3 + /home/mysite/framework/base/CModule.php(386): YiiBase::createComponent(array("urlFormat" => "path", "showScriptName" => false, "rules" => array("<controller:\w+>/<id:\d+>" => "<controller>/view", "<controller:\w+>/<action:\w+>/<id:\d+>/<title>" => "<controller>/<action>", "<controller:\w+>/<action:\w+>/<id:\d+>" => "<controller>/<action>", "<controller:\w+>/<action:\w+>/<title:\w+>" => "<controller>/<action>", …), "urlSuffix" => ".html", …))

#4 + /home/mysite/framework/base/CApplication.php(522): CModule->getComponent("urlManager")

#5 + /home/mysite/framework/web/CWebApplication.php(140): CApplication->getUrlManager()

#6 + /home/mysite/framework/base/CApplication.php(180): CWebApplication->processRequest()

#7 + /home/mysite/public_html/index.php(17): CApplication->run()

[/i]

The site is working fine in my Xampp windows local host. As I am new to remote server, I do not know what to do. I searched in the web and could not find any such thing happened to others. I look forward to some help.

Thanks in advance.

Have you checked the access rights of the files? Maybe the user that runs the apache does not have the rights to access these files.

include path is showing the path to models and components folder written in the application configuration file and the two files mentioned in the php.ini in the format required by php variable ‘include_path’.

I do not find any way out of this situation. I reinstalled the php version to 5.3.28 in vain and came back to original version.

If not a solution, I request a way forward from anybody who can understand my situation.

thanks,

Sorry for all those who read the post. It was a case of minor case insensitivity. That was not a problem in my windows system where I developed, but became a real issue in the Linux server.

Thanks for Yii team for this wonderful framework. God bless you all.