PHP Warning failed to open stream: No such file or directory

Hi I am facing an issue with my installation.

Below is the stack trace that I got. Please help. I am stuck at this for 2 hours now. I know its a silly mistake somewhere but I just can’t pinpoint it. Help is appreciated. Thanks




PHP warning


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


D:\wamp\www\unoagency\yii\framework\YiiBase.php(432)


420                         {

421                             include($classFile);

422                             if(YII_DEBUG && basename(realpath($classFile))!==$className.'.php')

423                                 throw new CException(Yii::t('yii','Class name "{class}" does not match class file "{file}".', array(

424                                     '{class}'=>$className,

425                                     '{file}'=>$classFile,

426                                 )));

427                             break;

428                         }

429                     }

430                 }

431                 else

432                     include($className.'.php');

433             }

434             else  // class name with namespace in PHP 5.3

435             {

436                 $namespace=str_replace('\\','.',ltrim($className,'\\'));

437                 if(($path=self::getPathOfAlias($namespace))!==false && is_file($path.'.php'))

438                     include($path.'.php');

439                 else

440                     return false;

441             }

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

443         }

444         return true;

Stack Trace

#0	

+  D:\wamp\www\unoagency\yii\framework\YiiBase.php(432): include()

#1	

 unknown(0): YiiBase::autoload("ac_created_on")

#2	

 unknown(0): spl_autoload_call("ac_created_on")

#3	

+  D:\wamp\www\unoagency\yii\framework\YiiBase.php(303): class_exists("ac_created_on", true)

#4	

+  D:\wamp\www\unoagency\yii\framework\validators\CValidator.php(174): YiiBase::import("ac_created_on", true)

#5	

+  D:\wamp\www\unoagency\yii\framework\base\CModel.php(287): CValidator::createValidator("ac_created_on", Account, array("ac_name"), array(0 => "required", "attributes" => array("ac_name")))

#6	

+  D:\wamp\www\unoagency\yii\framework\base\CModel.php(260): CModel->createValidators()

#7	

+  D:\wamp\www\unoagency\yii\framework\base\CModel.php(304): CModel->getValidators("ac_name")

#8	

+  D:\wamp\www\unoagency\yii\framework\web\helpers\CHtml.php(1514): CModel->isAttributeRequired("ac_name")

#9	

+  D:\wamp\www\unoagency\yii\framework\web\widgets\CActiveForm.php(600): CHtml::activeLabelEx(Account, "ac_name", array("class" => "col-sm-2 control-label"))

#10	

–  D:\wamp\www\unoagency\protected\views\account\_form.php(39): CActiveForm->labelEx(Account, "ac_name", array("class" => "col-sm-2 control-label"))

34         ?>

35 

36         <div class="form-group">

37             <?php

38             echo $form->labelEx($model, 'ac_name', array(

39                 'class' => 'col-sm-2 control-label',

40             ));

41             ?>

42             <div class="col-sm-4">

43                 <?php

44                     echo $form->textField($model, 'ac_name', array(

#11	

+  D:\wamp\www\unoagency\yii\framework\web\CBaseController.php(126): require("D:\wamp\www\unoagency\protected\views\account\_form.php")

#12	

+  D:\wamp\www\unoagency\yii\framework\web\CBaseController.php(95): CBaseController->renderInternal("D:\wamp\www\unoagency\protected\views\account\_form.php", array("model" => Account, "page" => 1), true)

#13	

+  D:\wamp\www\unoagency\yii\framework\web\CController.php(869): CBaseController->renderFile("D:\wamp\www\unoagency\protected\views\account\_form.php", array("model" => Account, "page" => 1), true)

#14	

–  D:\wamp\www\unoagency\protected\views\account\create.php(12): CController->renderPartial("_form", array("model" => Account, "page" => 1))

07     Yii::t('Account','Brands')=>array('admin'),

08     Yii::t('app','Create'),

09 );

10 ?>

11 

12 <?php $this->renderPartial('_form', array('model'=>$model,'page'=>$page)); ?>

#15	

+  D:\wamp\www\unoagency\yii\framework\web\CBaseController.php(126): require("D:\wamp\www\unoagency\protected\views\account\create.php")

#16	

+  D:\wamp\www\unoagency\yii\framework\web\CBaseController.php(95): CBaseController->renderInternal("D:\wamp\www\unoagency\protected\views\account\create.php", array("model" => Account, "page" => 1), true)

#17	

+  D:\wamp\www\unoagency\yii\framework\web\CController.php(869): CBaseController->renderFile("D:\wamp\www\unoagency\protected\views\account\create.php", array("model" => Account, "page" => 1), true)

#18	

+  D:\wamp\www\unoagency\yii\framework\web\CController.php(782): CController->renderPartial("create", array("model" => Account, "page" => 1), true)

#19	

–  D:\wamp\www\unoagency\protected\controllers\AccountController.php(84): CController->render("create", array("model" => Account, "page" => 1))

79             }

80         }

81         $page = Yii::app()->user->getState('Account_page', 1);

82         $this->render('create', array(

83             'model' => $model,

84             'page' => $page,

85         ));

86     }

87 

88     /**

89      * Updates a particular model.

#20	

+  D:\wamp\www\unoagency\yii\framework\web\actions\CInlineAction.php(49): AccountController->actionCreate()

#21	

+  D:\wamp\www\unoagency\yii\framework\web\CController.php(308): CInlineAction->runWithParams(array())

#22	

+  D:\wamp\www\unoagency\yii\framework\web\filters\CFilterChain.php(133): CController->runAction(CInlineAction)

#23	

+  D:\wamp\www\unoagency\yii\framework\web\filters\CFilter.php(40): CFilterChain->run()

#24	

+  D:\wamp\www\unoagency\yii\framework\web\CController.php(1145): CFilter->filter(CFilterChain)

#25	

+  D:\wamp\www\unoagency\yii\framework\web\filters\CInlineFilter.php(58): CController->filterAccessControl(CFilterChain)

#26	

+  D:\wamp\www\unoagency\yii\framework\web\filters\CFilterChain.php(130): CInlineFilter->filter(CFilterChain)

#27	

+  D:\wamp\www\unoagency\yii\framework\web\CController.php(291): CFilterChain->run()

#28	

+  D:\wamp\www\unoagency\yii\framework\web\CController.php(265): CController->runActionWithFilters(CInlineAction, array("accessControl", "postOnly + delete"))

#29	

+  D:\wamp\www\unoagency\yii\framework\web\CWebApplication.php(282): CController->run("create")

#30	

+  D:\wamp\www\unoagency\yii\framework\web\CWebApplication.php(141): CWebApplication->runController("account/create")

#31	

+  D:\wamp\www\unoagency\yii\framework\base\CApplication.php(185): CWebApplication->processRequest()

#32	

+  D:\wamp\www\unoagency\index.php(13): CApplication->run()

2017-11-10 17:41:11 Apache/2.4.27 (Win32) PHP/7.0.23 Yii Framework/1.1.17

you are using a class named ac_created_on some where in your code which yii autoloader cann’t find, class names and file names have to be same in order for yii2 to autoload your custom classes.


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