Cookie Problem

Code below was working on localhost but stop working after uploading on online host and I get this error:

Cannot modify header information - headers already sent by (output started at /home/.../public_html/.../protected/components/Controller.php:1)

if($cookie = new CHttpCookie('language','fa_ir')){

                    $cookie->expire = time()+60*30; 

                    Yii::app()->request->cookies['language'] = $cookie;//THIS LINE MAKES ERROR




Is cookie allowed on the client browser ?

It’s likely that you’ve got space characters in one of your PHP code files before the opening tag. Check your controller and model files to make sure there is nothing before the opening PHP tag.