Im using DB session class in my application. Everything was working fine, but all of a sudden it stopped. I changed conf, so now are used disk based sessions, but problems are still there. I was able to login, but right after Im getting this kind of error:
Thats strange, because user table was used for login action.
Another strange thing is that other application on the same server which is using same framework code and almost same conf with DB sessions is running fine.
In your entry script, declare the following two constants to be false (before you include yii.php). Then see what happens. Most likely, you have some PHP syntax errors.
That's why I suggested you declare the two constants to be false so that no error handler will be used in your application.
I suggest you insert some die() statements in your code and see which die() is reached and which not. By doing so, you can identify where the error occurs.
I have resolved problem with my application. Fault code was located in overridden class "components/DbHttpSession.php", where I declared new field for a session table (userID). What is still strange, I really don't know when "Yii::app()->user->id" stopped returning "0" (zero) for guest user. With old code it was running more than a month until now… This is what I did to fix it:
Old code:
New code:
Application is working back again. Thx for helping out!
Story continues… Strange thing happened to my other application which was running fine, while other was not. Both of them are using same framework code.
First one, which is using overridden DbHttpSession class, is now working with fixed binding of new userID field in session table.
Second application is using CDbHttpSession without any overriding -> there's not needed to have online users for any actions.
Today it (suddenly!) stopped working… First thing I did I declared the two constants of Yii handlers to be false. Here's what I got in next run:
SQL log showed deletion of expired sessions and then app tried to create new session table even if the table was there!
Today I was working mostly with layout and I left open one browser window for couple hours doing nothing - when I came back and clicked on refresh, strange fatal error pop up. Since then it is not working… I tried to delete session table and create it from scratch, but it didn't help.
I know there's "MySQL server has gone away" error mentioned in the output but mysql server is working fine, I think that this is more like session creation problem… Can somebody repeat this error to confirm it?
Also I think that problems with previous application started similar way, but I paniced and then I did a lot of changes to make it working (eg. changing CDbHttpSession to CHttpSession which didn't help either…)
Is there anybody who has no problems with DB sessions?