How to pass Yii session to scripts out of Yii framework?

I have a self-made math captcha and it should be output without anything before it’s header, so I can’t make it a ‘View’. I put this captcha.php in the web root dir, but it can’t share session with scripts in Yii. How to solve this?

Is there any way to pass the session from Yii to the other scripts or clean anything before the header in view?

try to do


CVarDumper::dump($_SESSION,10,true);

And you will see how the data is saved