Transferred Yii to New Server

Hi There,

I work at a school and we have a Yii app to manage kids assignments. We just transferred it over to a new server, setup the new database. We have made the /backed/web/assets folder writable by the apache process.

We are still getting a PHP error and we can’t figure out what we are doing wrong. Can anyone please help us.

Error

PHP Notice – yii\base\ErrorException

Undefined variable: url

  1. in /var/www/html/innerdesk/backend/themes/emphes/layouts/main.php at line 84

75767778798081828384858687888990919293 </div>

                    &#60;&#33;-- end: SEARCH FORM --&#62;


                    &#60;&#33;-- start: USER OPTIONS --&#62;


                    &lt;div class=&quot;nav-user-wrapper&quot;&gt;


                        &lt;div class=&quot;media&quot;&gt;


                            &lt;div class=&quot;media-left&quot;&gt;


                                &lt;? &#036;model = &#092;common&#092;models&#092;Profile::findOne(['pUser'=&gt;Yii::&#036;app-&gt;user-&gt;id]);


                                &#036;url = isset(&#036;model-&gt;photo)? Yii::getAlias('@web/uploads/').&#036;model-&gt;photo :&#036;this-&gt;theme-&gt;baseUrl.&quot;/assets/images/avatar-1.jpg&quot;;


                                ?&gt;


                                &lt;a class=&quot;profile-card-photo&quot; href=&quot;#&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;&lt;?php echo &#036;url ?&gt;&quot;&gt;&lt;/a&gt;


                            &lt;/div&gt;


                            &lt;div class=&quot;media-body&quot;&gt;





                                &lt;span class=&quot;media-heading text-white&quot;&gt;&lt;?= Yii::&#036;app-&gt;user-&gt;identity-&gt;username?&gt;&lt;/span&gt;


                                &lt;div class=&quot;text-small text-white-transparent&quot;&gt;





                                &lt;/div&gt;


                            &lt;/div&gt;


                            &lt;div class=&quot;media-right media-middle&quot;&gt;
  1. in /var/www/html/innerdesk/backend/themes/emphes/layouts/main.php at line 84 – yii\base\ErrorHandler::handleError(8, ‘Undefined variable: url’, ‘/var/www/html/innerdesk/backend/…’, 84, …)

78798081828384858687888990 <div class="nav-user-wrapper">

                        &lt;div class=&quot;media&quot;&gt;


                            &lt;div class=&quot;media-left&quot;&gt;


                                &lt;? &#036;model = &#092;common&#092;models&#092;Profile::findOne(['pUser'=&gt;Yii::&#036;app-&gt;user-&gt;id]);


                                &#036;url = isset(&#036;model-&gt;photo)? Yii::getAlias('@web/uploads/').&#036;model-&gt;photo :&#036;this-&gt;theme-&gt;baseUrl.&quot;/assets/images/avatar-1.jpg&quot;;


                                ?&gt;


                                &lt;a class=&quot;profile-card-photo&quot; href=&quot;#&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;&lt;?php echo &#036;url ?&gt;&quot;&gt;&lt;/a&gt;


                            &lt;/div&gt;


                            &lt;div class=&quot;media-body&quot;&gt;





                                &lt;span class=&quot;media-heading text-white&quot;&gt;&lt;?= Yii::&#036;app-&gt;user-&gt;identity-&gt;username?&gt;&lt;/span&gt;


                                &lt;div class=&quot;text-small text-white-transparent&quot;&gt;
  1. in /var/www/html/innerdesk/vendor/yiisoft/yii2/base/View.php at line 326 – require(’/var/www/html/innerdesk/backend/…’)

  2. in /var/www/html/innerdesk/vendor/yiisoft/yii2/base/View.php at line 248 – yii\base\View::renderPhpFile(’/var/www/html/innerdesk/backend/…’, [‘content’ => ‘<div class="container-fluid cont…’])

  3. in /var/www/html/innerdesk/vendor/yiisoft/yii2/base/Controller.php at line 393 – yii\base\View::renderFile(’/var/www/html/innerdesk/backend/…’, [‘content’ => ‘<div class="container-fluid cont…’], backend\controllers\SiteController)

  4. in /var/www/html/innerdesk/vendor/yiisoft/yii2/base/Controller.php at line 379 – yii\base\Controller::renderContent(’<div class="container-fluid cont…’)

  5. in /var/www/html/innerdesk/backend/controllers/SiteController.php at line 161 – yii\base\Controller::render(‘index’, [‘searchModel’ => backend\models\AssetSchoolSearch, ‘dataProvider’ => yii\data\ActiveDataProvider, ‘searchModel1’ => backend\models\StudentSearch, ‘dataProvider1’ => yii\data\ActiveDataProvider, …])

155156157158159160161162163164165166167 ‘data’=>$this->filterDashboard($dashboard),

                   'loandataProvider' =&gt; &#036;loandataProvider,


                   'ticketdataProvider' =&gt; &#036;ticketdataProvider,


                   'jobdataProvider' =&gt; &#036;jobdataProvider,


                   'staffdataProvider' =&gt; &#036;staffdataProvider,


                   'teacherdataProvider' =&gt; &#036;teacherdataProvider,


                   'studentprovider'=&gt;isset(&#036;studentprovider)?&#036;studentprovider:'',


                ]);


        } 


        else{ 


        &#036;searchModel = new AssetSearch();


        &#036;dataProvider = &#036;searchModel-&gt;search(Yii::&#036;app-&gt;request-&gt;queryParams);


         return &#036;this-&gt;render('index', [
  1. backend\controllers\SiteController::actionIndex()

  2. in /var/www/html/innerdesk/vendor/yiisoft/yii2/base/InlineAction.php at line 55 – call_user_func_array([backend\controllers\SiteController, ‘actionIndex’], [])

  3. in /var/www/html/innerdesk/vendor/yiisoft/yii2/base/Controller.php at line 154 – yii\base\InlineAction::runWithParams([])

  4. in /var/www/html/innerdesk/vendor/yiisoft/yii2/base/Module.php at line 454 – yii\base\Controller::runAction(’’, [])

  5. in /var/www/html/innerdesk/vendor/yiisoft/yii2/web/Application.php at line 100 – yii\base\Module::runAction(’’, [])

  6. in /var/www/html/innerdesk/vendor/yiisoft/yii2/base/Application.php at line 375 – yii\web\Application::handleRequest(yii\web\Request)

  7. in /var/www/html/innerdesk/backend/web/index.php at line 18 – yii\base\Application::run()

12131415161718 require(DIR . ‘/../../common/config/main-local.php’),

require(__DIR__ . '/&#46;&#46;/config/main.php'),


require(__DIR__ . '/&#46;&#46;/config/main-local.php')

);

$application = new yii\web\Application($config);

$application->run();

$_COOKIE = [

'PHPSESSID' =&gt; 'l6s2llj1tplkp7f9r4p8uaids3',


'_identity' =&gt; '3fc2e541bc8025699e021ec9f282795af45654eae9a1e1bc52c36481bfa5f580a:2:{i:0;s:9:&quot;_identity&quot;;i:1;s:47:&quot;[69,&quot;vZ6dSkmP7B9rBzLUnjeyzft9kOV4lPY_&quot;,2592000]&quot;;}',


'_csrf' =&gt; '91c59440432f33a28f6a12e02d04cb1ae65cda1903340f78cf324c0e7cb1dc48a:2:{i:0;s:5:&quot;_csrf&quot;;i:1;s:32:&quot;7gjXrS6goe5gXhTMwf60do08Yo9z_YNC&quot;;}',

];

$_SESSION = [

'__flash' =&gt; [],


'__returnUrl' =&gt; '/innerdesk/backend/web/index.php',


'__id' =&gt; 69,

];

Yii Framework

2017-02-04, 08:58:12

Apache/2.4.6 (CentOS) PHP/7.0.15

Yii Framework/2.0.10

Warning: file_put_contents(/var/www/html/innerdesk/backend/runtime/debug/589597a40cde1.data): failed to open stream: Permission denied in /var/www/html/innerdesk/vendor/yiisoft/yii2-debug/LogTarget.php on line 57

Warning: touch(): Utime failed: Permission denied in /var/www/html/innerdesk/vendor/yiisoft/yii2-debug/LogTarget.php on line 75

It seems like a permission problem with /var/www/html/innerdesk/backend/runtime/. You should make it writeable by the apache process just like backed/web/assets.

Also, where do you declare $url for /var/www/html/innerdesk/backend/themes/emphes/layouts/main.php?