Problems with AR or PDO

All of a sudden I noticed this error:

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.

Can anybody shed a light on this problem?

Thank you.


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.

Thanx for helping out, qiang. I did what you said, but still nothing.

There are no syntax errors in my code: Ive checked whole application with this snippet:

In my error log theres same error over and over.

I have found out that as "guest" application cant insert session into session table.

But once I logged in, strange error was gone, and my session was successfully created in table.

I did a research and it seems that this type of error could be caused by an exception thrown inside of error handler.

What else should I do to track this one?



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?

I just came across this article:…iscussionID=527

I restarted apache and application started working - as the author says, it seems to be a problem in php-fcgi or in pdo_mysql…

I have already got recent pdo_mysql on my box (solaris) before installing Yii, but it seems to be buggy or something… will try to look at it again.