PDOException during "Creating First Yii Application" tutorial

Hi all.

Recently I’ve lost two weeks trying to find the perfect PHP framework for me. Yesterday I’ve found Yii, and I was eager to dig into it. All thou Yii looks like it might be “it”, it seems that some voodoo magic forbids me to finally begin writing my project.

I’ve performed “yiic webapp” command, entered the generated code via the browser, and I’ve found the same bug that haunted me in other previously checked frameworks (i.e. Lion Framework with Doctrine integration) - stacktrace in the attachment. Previously I was sure that I have been doing something wrong - it has been a wile since my last PHP application. But now, when the bug shows in the generated code, I don’t know what else to do. Of course i theoretically know, why the PDO object can not be serialized, but I’ve dig the google, i’ve dig the Yii forum and I’ve found perfectly nothing about this error regarding the Yii framework.

My configuration is MsWindows XP SP3 + Apache 2.2.14 + php 5.3.1 (also tried 5.2.11). Can anybody point me to what might be wrong? Or shall I just leave that ugly language (PHP) and move to python , ruby or java ? ;]

Stacktrace here: 449


best regards, Xun

what version of Yii?

and what about Yii requirements checker? is everything ok?

check your D:\developement\workspace\php\tools\yii\requirements (or another)

i have similar operating system, using WAMP (windows apache mysql php) and everything is fine.

Right - I’ve forgot to include the Yii version. I’ve downloaded it yesterday, and it was the latests version marked as “stable” - 1.1.0 (January 10, 2010). In fact a good idea may be to try previous version (1.0.11) - I’ll check it right away.

The requirements went fine, except Memcache extension, and APC extension. I’ve assumed that they are not required (only warnings appeared), and according to the purpose of my application (it should be as easy to deploy as it could be) I’ll be glad if that was not an issue :)

Unfortunatelly, with version 1.0.11 i got the almost same result :confused:

Stacktrace in the attachment: 450


and do you change anything after running command "yiic webapp <location>" ? configuration file or other settings?

and could you paste here a way of your installation?

do you have installed standalone apache php and mysql or a complete package?

I’ve installed the apache and PHP alone, as i usually did.

The yii is located in d:\developement\workspace\php\tools\, and the command i invoked was like:

D:\developement\workspace\php\tools\yii_1.0\framework>yiic webapp "d:\developement\workspace\php\own\x_yii"

And I haven’t modified any files yet.

I keep thinking about the reason of this unexpected behavior. I read somewhere, that the caching is usually done by generating the hash code, which involves using the serializable interface. This maybe could be a problem somehow, but even so, i really don’t know where to look for easy solution - in my configuration (distribution version of php.ini-developement, with changed extension directory and uncommented needed extensions), or the Yii code (which is unlikely, due to lack of bugs/posts/google_search_results referring to this issue.

From your stacktrace it looks like a PDO object is saved in your session and PHP tries to unserialize it using the magic method __wakeup() on a PDO object, which fails.

No idea how that can happen. But maybe you can clear all your session files (== destroy all your sessions) and try again.

I’ve managed to fire up Yii and find the “bug”, due to suggestion using WAMP (thx funner). Among some differences in the wamp configuration and my default php configuration, there was session.save_path. Mine was uncofigured (and thus - commented), while in the default WAMP config it set. Setting it in the mine config worked, and now i can finally begin writing my app.

All thou shouldn’t it work anyway? With almost default PHP settings? Or shouldn’t be some info in the requirements? Of course this var should be set in my php config, but i tried to keep it as generic as possible.

Thx 4 help.

My guess is, you’d have had the same problem without Yii, as soon as you use sessions + PDO. So not a Yii specific problem.