I have read many times about this error and have seen the solutions offered in order to fix it.
But I am having a little bind.
Here is my setup.
My main Controller.php has defined AccessRules.
And when I use uploadify with firefox, it doesn’t seem to remember the session.
I have tried passing the PHPSESSID and setting it in my Action.
But the problem is tha the AccessRules are executed first, so before I can even grab the PHPSESSID and do anything it already kicks me out.
Is there a way around this? Like is there an event that is executed before AccessRules? I have looked for it but haven’t found much detail on that one.
The reason why I have some rules in the Controller is so that every other controller im using always uses the same access rules so your either logged in or not.
What I use to do the trick is to add the logic to the ‘onBeginRequest’ event, like
//config/main.php
return array(
'...',
'onBeginRequest'=>array('Bootstrap','init'),
//create a Bootstrap class
class Bootstrap{
function init($event){
//logic here
}
}
another option is to use the init method of your controller
// declare app object
$app = Yii::app();
// flash does NOT pass the session
// thus we pass the id with a $_POST variable
if (isset($_POST['PHPSESSID'])) {
$app->session->sessionID = $_POST['PHPSESSID'];
$app->session->init();
}
In my init portion of the Controller.php but I still get kicked out somehow.
If I remove the AccessRules portion completely from the Controller, it works no problem.
Do you think it could be a server configuration or something?
I have the same setup on a shared server and it works, the only diff on my ded server is that I updated to the latest php version and am using APC (oh yeah i clear the cache so it’s not a cache issue).
Dammit, I had to use this instead to make it work.
// declare app object
$app = Yii::app();
// flash does NOT pass the session
// thus we pass the id with a $_POST variable
if (isset($_POST['PHPSESSID'])) {
$app->session->close();
$app->session->sessionID = $_POST['PHPSESSID'];
$app->session->open();
}