title: working with PHP notice Undefined variable
body: <p>I am trying to fix this for while but I can't. I found several tutorials but I couldn't fix it. </p>
  
  <p>My friend and I are working on the same version, and it works on his PC without any problem - but for me it won't. We are using the same files, I copied mine from him. </p>
  
  <p>What is the matter here and why won't this work on my PC?</p>
  
  <p>Here is my index.php</p>
  
  <pre><code>&lt;?php
  /* @var $this SystemManagementController */
  /* @var $dataProvider CActiveDataProvider */
  ?&gt;
  &lt;?php
  $this-&gt;breadcrumbs = array(
      Yii::t('mainmenu', 'System Management'),
  );
  
  $contentTabUsers = $this-&gt;renderPartial('_tab_users', array(
      'model'              =&gt; $userModel,
      'columns'            =&gt; $userColumns,
      ), $return               = true);
  $contentTabStates    = $this-&gt;renderPartial('_tab_states', array('model'                     =&gt; $stateModel), $return                    = true);
  $contentTabPriorities    = $this-&gt;renderPartial('_tab_priorities', null, $return                     = true);
  $contentTabProperties    = $this-&gt;renderPartial('_tab_properties', null, $return                     = true);
  
  $upgradeLog = 'tbd'; //new UpgradeLog();
  
  $systemInfo = new SystemInfo();
  try
  {
      $systemInfoData = array(
          'System Info'    =&gt; $systemInfo-&gt;getServerInfo(),
          'Apache'         =&gt; $systemInfo-&gt;getApacheInfo(),
          'MySQL Info'     =&gt; $systemInfo-&gt;getMysqlInfo(),
      );
  }
  catch (Exception $ex)
  {
      Yii::log('Could not retrieve system info, exception thrown with message: ' . $ex-&gt;getMessage(), CLogger::LEVEL_ERROR);
      $systemInfoData = array();
  }
  $contentTabSysinfo = $this-&gt;renderPartial('_tab_sysinfo', array(
  //  'model'                  =&gt; $upgradeLog,
  //  'upgradeLogDataProvider' =&gt; $this-&gt;getUpgradeLogDataProvider(),
  //  'upgradeScripts'         =&gt; $this-&gt;getAllInfoUpgradeScripts(),
      'systemInfo' =&gt; $systemInfoData,
      'phpinfo'    =&gt; $this-&gt;getBasicPhpInfo(),
      ), $return       = true
  );
  
  
  
  
  // get the filter value to show max lines
  $showMaxLines    = (int) $this-&gt;getAppRequest()-&gt;getParam('log_show_max_lines', 50);
  $contentTabLog   = $this-&gt;renderPartial('_tab_log', array(
      'applicationLog' =&gt; $this-&gt;getLog($showMaxLines),
      'showMaxLines'   =&gt; $showMaxLines,
      // 'log_show_max_lines' is a placeholder for the js value in the template
      'filterUrl'      =&gt; $this-&gt;getYiiApp()-&gt;createUrl('systemManagement/index', array('log_show_max_lines' =&gt; null)),
      ), $return               = true
  );
  Yii::app()-&gt;user-&gt;setState('activeSystemmanagementTab', 'system_info');
  
  $tabs = array();
  if (Yii::app()-&gt;user-&gt;checkAccess('Systemmanagement.users'))
  {
      $tabs[Yii::t('systemmanagement', 'Users')] = array('content'     =&gt; $contentTabUsers, 'id'       =&gt; 'users');
  }
  if (Yii::app()-&gt;user-&gt;checkAccess('Systemmanagement.states'))
  {
      $tabs[Yii::t('systemmanagement', 'States')] = array('content'    =&gt; $contentTabStates, 'id'      =&gt; 'states');
  }
  if (Yii::app()-&gt;user-&gt;checkAccess('Systemmanagement.priorities'))
  {
      $tabs[Yii::t('systemmanagement', 'Priorities')] = array('content'    =&gt; $contentTabPriorities, 'id'      =&gt; 'priorities');
  }
  if (Yii::app()-&gt;user-&gt;checkAccess('Systemmanagement.properties'))
  {
      $tabs[Yii::t('systemmanagement', 'Properties')] = array('content'    =&gt; $contentTabProperties, 'id'      =&gt; 'properties');
  }
  if (Yii::app()-&gt;user-&gt;checkAccess('Systemmanagement.sysinfo'))
  {
      $tabs[Yii::t('systemmanagement', 'System Info')] = array('content'   =&gt; $contentTabSysinfo, 'id'         =&gt; 'system_info');
  }
  if (Yii::app()-&gt;user-&gt;checkAccess('Systemmanagement.log'))
  {
      $tabs[Yii::t('systemmanagement', 'Log')] = array('content'   =&gt; $contentTabLog, 'id'         =&gt; 'log');
  }
  
  $this-&gt;widget('zii.widgets.jui.CJuiTabs', array(
      'tabs'       =&gt; $tabs,
      // additional javascript options for the tabs plugin
      'options'    =&gt; array(
          'collapsible'    =&gt; true,
          'hide'           =&gt; 'fade',
          'activeTab'      =&gt; Yii::app()-&gt;user-&gt;getState('activeSystemmanagementTab'),
  //      'show'           =&gt; 'highlight',
          //TODO @see http://www.bsourcecode.com/2012/11/how-to-handle-cjuitabs-in-yii/
          'selected'       =&gt; isset(Yii::app()-&gt;session['tabid']) ? Yii::app()-&gt;session['tabid'] : 0,
          'select'         =&gt; 'js:function(event, ui) {
              var index=ui.index;
              $.ajax({
                  "url":"' . Yii::app()-&gt;createUrl('site/tabidsession') . '",
                  "data":"tab="+index,
              });
      }',
      )
      )
  );
  ?&gt;
  &lt;script type="text/javascript"&gt;
      function changeIsactive(id)
      {
          $.ajax({
              type: 'post',
              url: "&lt;?php echo Yii::app()-&gt;createUrl('usp/AjaxSetuspOnOff') ?&gt;",
              datatype: 'json',
              data: "MeId=" + id,
              success: function (data) {
                  // if page access denied show the error msg
                  var hasError = $("&lt;div&gt;&lt;/div&gt;").append(data).find("#content div.error").length &gt; 0;
                  if (hasError)
                  {
                      $("#flashmsg").show().addClass('flash-error').html('&lt;?php echo Yii::t('systemwide', 'You Are Not Authorized to Turn On/Off this ELement'); ?&gt;').animate({opacity: 0.9}, 3500).fadeOut("slow");
                      return false;
                  } else {
                      if (data != 'error')
                      {
                          if (data)
                          {
                              $('#onOff_' + id).addClass(data);
                          }
                          else {
                              $('#onOff_' + id).removeClass('checked');
                          }
                      }
                      else
                      {
                          $("#flashmsg").show().addClass('flash-error').html('&lt;?php echo Yii::t('systemwide', 'You Are Not Authorized to Turn On/Off this ELement'); ?&gt;').animate({opacity: 0.9}, 3500).fadeOut("slow");
                      }
                      return false;
                  }
              },
              error: function (jqXHR, exception) {
                  $("#flashmsg").show().addClass('flash-error').html('&lt;?php echo Yii::t('systemwide', 'You Are Not Authorized to Turn On/Off this ELement'); ?&gt;').animate({opacity: 0.9}, 3500).fadeOut("slow");
              }
          });
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>when I go to the server I get this error:</p>
  
  <blockquote>
    <p>PHP notice Undefined variable: tabs /var/www/private/protected/views/systemmanagement/index.php(84)</p>
  </blockquote>
  
  <p>and that is referring to :</p>
  
  <pre><code>'tabs'       =&gt; $tabs,
  </code></pre>
  
  <p>in order to fix this I added, the following also on top of my file:</p>
  
  <pre><code>$tabs = array();
  </code></pre>
  
  <p>Now when I do this, it works and it doesn't give any error, but it just goes to the page and it doesn't show any content. Please help I am spending too much time on this.</p>
  
  <p>if I put this in my code: </p>
  
  <blockquote>
    <p>print_r($systemInfoData);</p>
  </blockquote>
  
  <p>I get:</p>
  
  <pre><code>Array ( [System Info] =&gt; Array ( [OS] =&gt; Linux #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 [Machine Type] =&gt; x86_64 [Server Name] =&gt; 192.168.33.10 [Server IP Address] =&gt; 192.168.33.10 ) [Apache] =&gt; Array ( [version] =&gt; Apache/2.4.12 (Ubuntu) [Loaded Modules] =&gt; core, mod_so, mod_watchdog, http_core, mod_log_config, mod_logio, mod_version, mod_unixd, mod_access_compat, mod_alias, mod_auth_basic, mod_authn_core, mod_authn_file, mod_authz_core, mod_authz_groupfile, mod_authz_host, mod_authz_user, mod_autoindex, mod_cgi, mod_deflate, mod_dir, mod_env, mod_expires, mod_filter, mod_headers, mod_include, mod_mime, prefork, mod_negotiation, mod_php5, mod_reqtimeout, mod_rewrite, mod_setenvif, mod_status ) [MySQL Info] =&gt; Array ( [Server version] =&gt; 5.5.43-0ubuntu0.12.04.1 [Meta information] =&gt; Uptime: 11334 Threads: 1 Questions: 11476 Slow queries: 0 Opens: 76 Flush tables: 1 Open tables: 54 Queries per second avg: 1.012 ) )
  </code></pre>