$This->Redirect Stop Working

Ok. Localhost it works, shared host windows plan it works.

After change to a linux plan, $this->redirect stop working

$this->redirect(array('reserva/view/', 'id' => $idreserva, 'fromP' => '1'));

If it works on Windows and not Linux, the first thing to check is capitalisation of your file names. Make sure that your class files follow the expected capitalisation rules.

Are you getting an error?

Nop. Just a blank screen on the action where the redirect is

thanks in advance.

But really stucked.

It works on my ubuntu lamp, on windows xamp and windows host.Strange.

if (isset($idreserva)) {


            $this->redirect(array('reserva/view/', 'id' => $idreserva, 'fromP' => '1',));

        } else {

            $this->redirect(array('casa/update', 'id' => $cod_casa, 'fromP' => '1',));


but this code in another controller works

                $this->redirect(Yii::app()->createUrl('casa/update', array('cod_casa' => $model->cod_casa, 'id' => $model->cod_casa, 'referer' => 'periodo')));

yep see the diference? Yes but it works on xamp and local ubuntu.

                $this->redirect(array('pwdrecoverconfirm', 'id' => $model->propid, 'st' => $model->sessid));

and this also works. fck

Is the extra forward slash after "view" causing a problem?

no.still the same

trying to redirect to another action in same controller , another blank screen

public function actionCreate() {

        $Pagamento = new ReservaPayment();

        $Reserva = new Reserva();

        $model = new Preco('create');


        $uid = Yii::app()->user->name == ("admin") ? " >=1" : "=" . Yii::app()->user->id;

        $cod_casa = Yii::app()->getRequest()->getQuery('cod_casa');

        $this->actionCalendar($cod_casa, 0);

        // $this->performAjaxValidation($model);

        if (isset($_POST['Preco'])) {

            $model->attributes = $_POST['Preco'];

            if ($model->save()) {

                Yii::app()->user->setFlash('success', 'Ok com disponibilidade!', true);

                $id = Yii::app()->db->lastInsertID;

                if (isset($_POST['Reserva'])) {

                    $Reserva->attributes = $_POST['Reserva'];


                    $Reserva->user = $_POST['Reserva']['user'];

                    $Reserva->idpreco = $id;

                    $Reserva->reserva_state = $_POST['Reserva']['reserva_state'];

                    if ($Reserva->save()) {

                        $idreserva = Yii::app()->db->lastInsertID;





                    } else {

                        Yii::app()->user->setFlash('error', 'Erro com Reserva!', true);



                if (isset($_POST['ReservaPayment'])) {

                    $Pagamento->attributes = $_POST['ReservaPayment'];

                    if (isset($idreserva)) {

                        $Pagamento->idreserva = $idreserva;


                    $Pagamento->idpreco = $id;

                    if ($Pagamento->save()) {

                        Yii::app()->user->setFlash('success', 'Ok com Periodo Reserva Pagamento !', true);

                    } else {

                        Yii::app()->user->setFlash('error', 'Pagamento não introduzido !', true);




        } else {

            Yii::app()->user->setFlash('error', 'Erro com Periodo Reserva e pagamento! Confira as datas em conflito', true);


        if (isset($idreserva)) {


            $this->redirect('reserva/view/', array('id' => $idreserva, 'fromP' => '1',));

        } else {

            $this->redirect('casa/update', array('id' => $cod_casa, 'fromP' => '1',));



works in other environments.Any ideas what happen?

Host php version, i think

blank screen in which action? what is the url?

You can remove the UTF-8 BOM from the output using the ob_start function. This way you can leave the UTF-8 BOM in your source files so your editor understands it is really UTF-8.

In the /protected/config/main.php you have to add before returning the config array:


function My_OB($str, $flags)


    //remove UTF-8 BOM

    $str = preg_replace("/\xef\xbb\xbf/","",$str);


    return $str;


return array( ... yii config array ...);

P.S. You don’t have to call ob_end_flush(), php will do this automatically at the end of the script.

BOM problems… Working on Windows is always a very bad idea… I didn’t use Windows since almost 8 years, and I really don’t understand how PHP developpers can stay on Windows ? 99% of web servers are Linux based, so, using Linux everyday and learning bash scripting is a good practice.

Blank pages can also be some PHP errors. In general, on Linux, you’ll find them on /var/log/apache2/error.log.Wich Linux are you using ?

This solved exactly the problem! Thx