Undefined variable: model

Hi,

I copied all files from my computer to the serwer "test server" and my "client server". On my "test serwer it working correctly" but on the client serwer o got error. (servers are not on the same hosing company)

I guess that something is wrong with client’s server configuration?

Where should I set chmod 777?

What may be the reason of the error?




Opis


Undefined variable: model


Plik źródłowy


/home/***/public_html/portal/cms/protected/controllers/NewsController.php(317)


00305:         ));

00306:     }

00307: 

00308:     /**

00309:      * Returns the data model based on the primary key given in the GET variable.

00310:      * If the data model is not found, an HTTP exception will be raised.

00311:      * @param integer the ID of the model to be loaded

00312:      */

00313:     public function loadModel($id)

00314:     {

00315:     $session = new CHttpSession();

00316:         $session->open();

00317:         if ($model === null)

00318:         {

00319:             if (isset($id))

00320:                 $model = News::model()->with('cat', 'langText')->find(

00321:                 array('select' => '*', 

00322:                 'condition' => 'isActive=1 and t.pageID=:pageID and langText.languageID=:langID', 

00323:                 'params' => array(':pageID' => (int)$id, 

00324:                 ':langID' => $session['language'])));

00325:             if ($model === null)

00326:                 throw new CHttpException(404, 

00327:                 'The requested page does not exist.');

00328:         }

00329:         

Stack Trace


#0 /home/***/public_html/portal/cms/protected/controllers/NewsController.php(53): NewsController->loadModel()

#1 unknown(0): NewsController->actionView()

#2 /home/***/public_html/portal/framework/web/actions/CInlineAction.php(47): ReflectionMethod->invokeArgs()

#3 /home/***/public_html/portal/framework/web/CController.php(300): CInlineAction->run()

#4 /home/***/public_html/portal/framework/web/filters/CFilterChain.php(133): NewsController->runAction()

#5 /home/***/public_html/portal/framework/web/filters/CFilter.php(41): CFilterChain->run()

#6 /home/***/public_html/portal/framework/web/CController.php(1049): CAccessControlFilter->filter()

#7 /home/***/public_html/portal/framework/web/filters/CInlineFilter.php(59): NewsController->filterAccessControl()

#8 /home/***/public_html/portal/framework/web/filters/CFilterChain.php(130): CInlineFilter->filter()

#9 /home/***/public_html/portal/framework/web/CController.php(283): CFilterChain->run()

#10 /home/***/public_html/portal/framework/web/CController.php(257): NewsController->runActionWithFilters()

#11 /home/***/public_html/portal/framework/web/CWebApplication.php(324): NewsController->run()

#12 /home/***/public_html/portal/framework/web/CWebApplication.php(121): CWebApplication->runController()

#13 /home/***/public_html/portal/framework/base/CApplication.php(135): CWebApplication->processRequest()

#14 /home/***/public_html/portal/cms/index.php(15): CWebApplication->run()



at the very beginning of your newscontroller put


public $model;

I don’t see all your code… but in the first testing if ($model === nulll)… $model is not set and that’s why you get the error…

I suppose this "if" can safely be removed… as you have to find the model by $id… so to leave only if(isset($id))…

I changed it and I got error:

Is serwer in other hosting company it is working correctly :(





copy() [<a href='function.copy'>function.copy</a>]: SAFE MODE Restriction in effect. The script whose uid/gid is 1084/100 is not allowed to access /home/***/public_html/portal/cms/assets/dce32289 owned by uid/gid 99/99


Plik źródłowy

***/public_html/portal/framework/utils/CFileHelper.php(125)


00113:         @mkdir($dst);

00114:         @chmod($dst,0777);

00115:         $folder=opendir($src);

00116:         while(($file=readdir($folder))!==false)

00117:         {

00118:             if($file==='.' || $file==='..')

00119:                 continue;

00120:             $path=$src.DIRECTORY_SEPARATOR.$file;

00121:             $isFile=is_file($path);

00122:             if(self::validatePath($base,$file,$isFile,$fileTypes,$exclude))

00123:             {

00124:                 if($isFile)

00125:                     copy($path,$dst.DIRECTORY_SEPARATOR.$file);

00126:                 else if($level)

00127:                     self::copyDirectoryRecursive($path,$dst.DIRECTORY_SEPARATOR.$file,$base.'/'.$file,$fileTypes,$exclude,$level-1);

00128:             }

00129:         }

00130:         closedir($folder);

00131:     }

00132: 

00133:     /**

00134:      * Returns the files found under the specified directory and subdirectories.

00135:      * This method is mainly used by {@link findFiles}.

00136:      * @param string the source directory

00137:      * @param string the path relative to the original source directory

Stack Trace


#0 /home/***/public_html/portal/framework/utils/CFileHelper.php(125): copy()

#1 /home/***/public_html/portal/framework/utils/CFileHelper.php(62): copyDirectoryRecursive()

#2 /home/***/public_html/portal/framework/web/CAssetManager.php(158): copyDirectory()

#3 /home/***/public_html/portal/cms/protected/extensions/fancybox/EFancyBox.php(57): CAssetManager->publish()

#4 /home/***/public_html/portal/cms/protected/extensions/fancybox/EFancyBox.php(43): EFancyBox->publishAssets()

#5 /home/***/public_html/portal/framework/web/CBaseController.php(140): EFancyBox->init()

#6 /home/***/public_html/portal/framework/web/CBaseController.php(165): NewsController->createWidget()

#7 /home/***/public_html/portal/cms/protected/views/news/view.php(25): NewsController->widget()

#8 /home/***/public_html/portal/framework/web/CBaseController.php(119): require()

#9 /home/***/public_html/portal/framework/web/CBaseController.php(88): NewsController->renderInternal()

#10 /home/***/public_html/portal/framework/web/CController.php(798): NewsController->renderFile()

#11 /home/***/public_html/portal/framework/web/CController.php(739): NewsController->renderPartial()

#12 /home/***/public_html/portal/cms/protected/controllers/NewsController.php(214): NewsController->render()

#13 unknown(0): NewsController->actionView()

#14 /home/***/public_html/portal/framework/web/actions/CInlineAction.php(47): ReflectionMethod->invokeArgs()

#15 /home/***/public_html/portal/framework/web/CController.php(300): CInlineAction->run()

#16 /home/***/public_html/portal/framework/web/filters/CFilterChain.php(133): NewsController->runAction()

#17 /home/***/public_html/portal/framework/web/filters/CFilter.php(41): CFilterChain->run()

#18 /home/***/public_html/portal/framework/web/CController.php(1049): CAccessControlFilter->filter()

#19 /home/***/public_html/portal/framework/web/filters/CInlineFilter.php(59): NewsController->filterAccessControl()

#20 /home/***/public_html/portal/framework/web/filters/CFilterChain.php(130): CInlineFilter->filter()

#21 /home/***/public_html/portal/framework/web/CController.php(283): CFilterChain->run()

#22 /home/***/public_html/portal/framework/web/CController.php(257): NewsController->runActionWithFilters()

#23 /home/***/public_html/portal/framework/web/CWebApplication.php(324): NewsController->run()

#24 /home/***/public_html/portal/framework/web/CWebApplication.php(121): CWebApplication->runController()

#25 /home/***/public_html/portal/framework/base/CApplication.php(135): CWebApplication->processRequest()

#26 /home/***/public_html/portal/cms/index.php(15): CWebApplication->run()



I have also other error even more strange:




Opis


Use of undefined constant Zobacz - assumed 'Zobacz'


Plik źródłowy


/home/***/public_html/portal/framework/base/CComponent.php(616) : eval()'d code(1)


Brak kodu �r�d�owego. //ang: "no source code"

Stack Trace


#0 /home/***/public_html/portal/framework/base/CComponent.php(616): eval()

#1 /home/***/public_html/portal/framework/zii/widgets/grid/CLinkColumn.php(87): CLinkColumn->evaluateExpression()

#2 /home/***/public_html/portal/framework/zii/widgets/grid/CGridColumn.php(135): CLinkColumn->renderDataCellContent()

#3 /home/***/public_html/portal/framework/zii/widgets/grid/CGridView.php(457): CLinkColumn->renderDataCell()

#4 /home/***/public_html/portal/framework/zii/widgets/grid/CGridView.php(430): CGridView->renderTableRow()

#5 /home/***/public_html/portal/framework/zii/widgets/grid/CGridView.php(343): CGridView->renderTableBody()

#6 /home/***/public_html/portal/framework/zii/widgets/CBaseListView.php(158): CGridView->renderItems()

#7 unknown(0): CGridView->renderSection()

#8 /home/***/public_html/portal/framework/zii/widgets/CBaseListView.php(141): preg_replace_callback()

#9 /home/***/public_html/portal/framework/zii/widgets/CBaseListView.php(127): CGridView->renderContent()

#10 /home/***/public_html/portal/framework/web/CBaseController.php(166): CGridView->run()

#11 /home/***/public_html/portal/cms/protected/views/advertisements/list.php(55): AdvertisementsController->widget()

#12 /home/***/public_html/portal/framework/web/CBaseController.php(119): require()

#13 /home/***/public_html/portal/framework/web/CBaseController.php(88): AdvertisementsController->renderInternal()

#14 /home/***/public_html/portal/framework/web/CController.php(798): AdvertisementsController->renderFile()

#15 /home/***/public_html/portal/framework/web/CController.php(739): AdvertisementsController->renderPartial()

#16 /home/***/public_html/portal/cms/protected/controllers/AdvertisementsController.php(167): AdvertisementsController->render()

#17 /home/***/public_html/portal/framework/web/actions/CInlineAction.php(50): AdvertisementsController->actionList()

#18 /home/***/public_html/portal/framework/web/CController.php(300): CInlineAction->run()

#19 /home/***/public_html/portal/framework/web/filters/CFilterChain.php(133): AdvertisementsController->runAction()

#20 /home/***/public_html/portal/framework/web/filters/CFilter.php(41): CFilterChain->run()

#21 /home/***/public_html/portal/framework/web/CController.php(1049): CAccessControlFilter->filter()

#22 /home/***/public_html/portal/framework/web/filters/CInlineFilter.php(59): AdvertisementsController->filterAccessControl()

#23 /home/***/public_html/portal/framework/web/filters/CFilterChain.php(130): CInlineFilter->filter()

#24 /home/***/public_html/portal/framework/web/CController.php(283): CFilterChain->run()

#25 /home/***/public_html/portal/framework/web/CController.php(257): AdvertisementsController->runActionWithFilters()

#26 /home/***/public_html/portal/framework/web/CWebApplication.php(324): AdvertisementsController->run()

#27 /home/***/public_html/portal/framework/web/CWebApplication.php(121): CWebApplication->runController()

#28 /home/R***/public_html/portal/framework/base/CApplication.php(135): CWebApplication->processRequest()

#29 /home/***/public_html/portal/cms/index.php(15): CWebApplication->run()



Seems that on this server you have PHP5.3

Note that on older version you could use


$array[key]

but on PHP 5.3 this gives you the error - Use of undefined constant key - assumed ‘key’

So on PHP 5.3 you have to use (work in older version too)


$array['key']

The other error:

SAFE MODE Restriction in effect.

The script whose uid/gid is 1084/100 is not allowed to access

/home/***/public_html/portal/cms/assets/dce32289 owned by uid/gid 99/99

Has something with SAFE MODE enabled and permissions… try to disable the SAFE MODE…

In order to avoid such problems in deployment, I suggest to set in the index php:




<?php 

error_reporting(E_ALL);

ini_set('display_errors',1);



Like that you will use the most restrective configuration possible on your development machine, so lot of notice or error you will catch during development.