// Expect yii/ to be next to "index.php"'s parent directory. Please adapt.
require_once dirname(dirname(__FILE__)) . '/../../../../yii/framework/yii.php';
AFAIK, the path to “yii.php” is only in “/index.php” and “/index-test.php”. But I can’t include these files because they would launch an application. Parsing them would be uglier.
To make things portable, Yii could have somewhere (e.g. in "/protected/extensions/") a file that would load "yii.php". Unfortunately, if the path to Yii was to change, the user would modify "/index.php", but probably not this new file. So, IMHO, the path to "yii.php" (or an include of it) should be in a separate file used by all ("/index.php" et al.).