Yiiboilerplate: Invalid Alias

Hi people,

Making my first steps with Yii. :)

I am trying to setup an application that will make use of YiiBoilerplate. (*)

So far so good: after the install (and moving directories, simplifying the environment switching code, etcetera) I do get the expected output from "index.php" of the frontend.

Next step I am trying: get the Bootstrap extension loaded. I am following the instructions from the link above below.(*) But I am afraid these are not complete.

Here is what I added in main.php:

Yii::setPathOfAlias('ext', $root . DIRECTORY_SEPARATOR . 'common' . DIRECTORY_SEPARATOR . 'extensions');


		'preload' => array('log', 'bootstrap'),


     	'components' => array(


            'bootstrap' => array(

                'class' => 'ext.bootstrap.components.Bootstrap',

                'responsiveCss' => false,


The site no longer works, but returns an error:

Alias "ext.bootstrap.components.Bootstrap" is invalid. Make sure it points to an existing PHP file and the file is readable.

(Error 500) 

Yet, the following prints "1", so the file does exist and is readable, no ?

echo "<pre>" . is_file(Yii::getPathOfAlias('ext.bootstrap.components.Bootstrap') . ".php") . "</pre>";

Any ideas where to look ?

Even better: is anybody willing to share a minimalistic YiiBoilerplate application that actually loads the Bootstrap component and displays some widgets ? It would definitely help me climb the learning curve! ;)

Cheers & thanks,


(*) I am not allowed to post links yet, so here it is spelled out: yii-booster.clevertech.biz/getting-started.html

I think I am getting closer to the problem.

In main.php I have this:

[font="Courier New"]…

Yii::setPathOfAlias(‘root’, $root);

[b]Yii::setPathOfAlias(‘ext’, $root . DIRECTORY_SEPARATOR . ‘[color="#2E8B57"]common[/color]’ . DIRECTORY_SEPARATOR . ‘extensions’);




	[b]'basePath' =&gt; &#036;root . '/frontend'[/b],


If I run the test for the correct interpretation of the classname ext.bootstrap.components.Bootstrap:

[font=“Courier New”]$yii=dirname(FILE).’/../../../yii/yii-1-1-12/framework/yii.php’;




echo “<pre>” . Yii::getPathOfAlias(‘ext.bootstrap.components.Bootstrap’) . “</pre>”;


then this returns (correctly)

[font="Courier New"]/var/www/YiiBoilerplate-dev/[color="#2E8B57"]common[/color]/extensions/bootstrap/components/Bootstrap[/font]

When I try to instantiate a CWebApplication it seems to ignore the previous calls to Yii::setPathOfAlias. I amended the raised exception to include the missing path instead of only reporting the problematic alias name (line 382 in YiiBase.php). The error reads:

[font="Courier New"]Alias "ext.bootstrap.components.Bootstrap" is invalid. Make sure it points to an existing PHP file and the file is readable. This is the presumed path: "/var/www/YiiBoilerplate-dev/[color="#FF0000"]frontend[/color]/extensions/bootstrap/components/Bootstrap.php"[/font]

It seems that basePath takes precedence over earlier setPathOfAlias calls ? Is this expected behaviour ? If so, how to set the "ext" alias to some location out of basePath ?

Thank you,


Ok, found it! :)

The creation of a CWebApplication object resets some aliases to default loations starting from the basePath, one of them being "ext".

I had to change

Yii::setPathOfAlias('ext', $root . DIRECTORY_SEPARATOR . 'common' . DIRECTORY_SEPARATOR . 'extensions');


Yii::setPathOfAlias('extcommon', $root . DIRECTORY_SEPARATOR . 'common' . DIRECTORY_SEPARATOR . 'extensions');

and then in the config settings:

'bootstrap' => array('class' => 'extcommon.bootstrap.components.Bootstrap')

Thank you for listening ;)

i had the same problem, But i realize that , i have the same copy (common) in root (outside of project) folder (like in www), when i delete i got the solution !!!

[color="#006400"]/* moved from Installation & Setup */[/color]