Session Problem

I’m working on shopping cart function, when I try to use session to store same data, NO data stored even using CHttpSession or CDbHttpSession.

Here are my code.

config


session' => array(

            'class' => 'CDbHttpSession',

            'connectionID' => 'db',

            'autoCreateSessionTable' => false,

            'autoStart' => false,

        ),

controllor


$session = Yii::app()->session;

                $session->open();

                $session->clear();

                foreach ($_POST['order'] as $item => $quantity) {

                    if ($quantity != '' && !is_null((int)$quantity)) {

                        if ((int)$quantity > 0) {

                            $session[$item] = (int)$quantity;

                        }

                    }

                }

                CVarDumper::dump($session->toArray(), 10, TRUE);

                $session->close();

                $session = Yii::app()->session;

                $session->open();

                CVarDumper::dump($session->toArray(), 10, TRUE);

                $session->close();

output


array

(

    2 => 1

    1 => 1

) array()

I don’t know where the problem are. Are there any php config / app config may affect yii session function?