1

I ran into this while trying to install several Yii extensions.

E.g. http://www.yiiframework.com/extension/yii-debug-toolbar/ or http://www.yiiframework.com/extension/yiidebugtb/

Instructions say to get this in the components part of config/main.php:

'log'=>array(
        'class'=>'CLogRouter',
        'routes'=>array(
            array(
                'class'=>'ext.yii-debug-toolbar.YiiDebugToolbarRoute',
                'ipFilters'=>array('127.0.0.1','192.168.1.215'),
            ),
        ),
    ),

However, my log > routes is an associative array.

This is what mine looks like:

'log'=>array(
    'class'=>'CLogRouter',
    'routes'=>array(
        'web'=>array(
                'class'=>'CWebLogRoute',
                'levels'=>'error, warning',
                'categories'=>'system.db.*,hhinfo',
                'showInFireBug'=>true 
        ),
        'file'=>array(
                'class'=>'CFileLogRoute',
                'levels'=>'error, warning, watch',
                'categories'=>'system.*',
        ),
        'profile'=>array(
            'class' => 'CProfileLogRoute',
            'report'=>'summary',
        ),
    ),
),

Does anyone know how I can install the extensions?

Nelu
  • 16,644
  • 10
  • 80
  • 88

2 Answers2

1

To configure yii debug toolbar you need to add this in your log config:

'log'=>array(
            'class'=>'CLogRouter',
            'routes'=>array(
                array(
                    'class'=>'CFileLogRoute',
                    'levels'=>'error, warning', //'trace, info, error, warning, vardump'
                ),
                array(
                    'class'=>'ext.yii-debug-toolbar.YiiDebugToolbarRoute',
                    'ipFilters'=>array('127.0.0.1','::1','localhost'),
                    ),
            .......

Your problem can be the ipFilters because you need to add the correct ip(v4 and v6) and you need to extract yii-debug-toolbar from zip archive folder to extensions folder.

TotPeRo
  • 6,561
  • 4
  • 47
  • 60
  • 1
    I added that code under `routes` and extracted the files in the `extensions` folder. For the IP's I'm just using localhost, the instructions don't say I need anything different than what's provided. I think the issue is in the fact that my `routes` is an associative array. Is it possible to add non-associative values to it? – Nelu Jun 11 '14 at 20:59
  • add to ipfilters all i have add: **'127.0.0.1','::1','localhost'** because i have the same problem and i solve like this. – TotPeRo Jun 11 '14 at 21:05
  • 1
    in ip filter you need to have the same ip like this **var_dump(Yii::app()->request->userHostAddress)** – TotPeRo Jun 11 '14 at 21:08
  • I have a same situation. I've added extension to /extensions' folder, set config for my app as provided in instrallation instructions. I see that YiiDebugToolbarRoute is loading (YiiDebugToolbarRoute is executing init() function) but i don't see any additional panel. I also see CWebLogRoute panel - track of application. – mrarm Nov 25 '16 at 09:22
0

It turns out that combining a non-associative member to the routes array is perfectly fine.

I haven't figured out why http://www.yiiframework.com/extension/yiidebugtb/ isn't working.

But the problem with http://www.yiiframework.com/extension/yii-debug-toolbar/ was that it appeared only on certain pages, and it shows as a small plus sign in the top right corner. I missed it.

I also found that if you're using it locally you don't need an IP address. Just:

'routes'=>array(
    array(
        'class'=>'ext.yii-debug-toolbar.YiiDebugToolbarRoute',
    ),
),
Nelu
  • 16,644
  • 10
  • 80
  • 88
  • by default $ipFilters=array('127.0.0.1','::1'); but if you use private/interanet ip like: 192.168.0.2 you need to add 'ipFilters'=>array('127.0.0.1','::1','192.168.0.2'). – TotPeRo Jun 12 '14 at 10:57