dirname(Yii::app()->request->scriptFile);
This results in the full directory names of the web root.e.g. /home/example.org/www/yii/protectedhttp://www.yiiframework.com/forum/index.php?/topic/536-basepath-url/page__hl__scriptFile%20__fromsearch__1
The one below returns " /yii/protected/ ".
<?php echo Yii::app()->request->baseUrl; ?>