Issue with PDO

Dear all,

I encounter a little issue while "implementing CRUD operations" ("Creating first Yii application").

At the prompt, when I execute the sub-commands "model User" I have the following message:

Fatal error : Class 'PDO' not found in …\framework\db\CDbConnection.php on line 274

I am using PDO with MySql.

PDO extensions are enabled. (php_pdo , php_pdo_mysql). Phpinfo shows that the extensions are enabled.

I watched for the different php.ini files and extensions are enabled.

Configuration : php 5.2.8 + mysql 5.1.30

An other user (see SAEVAN post) encountered the same problem a few days ago and fixed it by himself without telling how.

Please help !

Thank you veru much in advance.  ;)

You CLI PHP is using a different php.ini.

You may call "php -c path/to/php.ini" to enforce it to use a specific php.ini.

Concerning the problem i had a few days ago, I forgot to add the path to the yiic.bat file into the environment variables of windows.

Here is a link where you can find how to setup yiic on windows (using wampserver).

http://www.yiiframew…doc/cookbook/3/

Hope it can help you.

I have replied by pm too, but sorry for being late.

I’m using version 4.2 of the Uniform Server (PHP, MySQL, Apache - see http://www.uniformserver.com/) on Windows XP.

I'm not sure whether the following information is relevant, but upon startup of the above environment, a "Z" shadow drive is created where Z: maps to the original path, "E:\UniServer\udrive".

I stuck with the E drive and appended my System environment Path variable per the instructions (and supplementary messages) at http://www.yiiframew…doc/cookbook/3/ as follows:

"other path settings…;e:\uniserver\udrive\usr\local\php;e:\uniserver\udrive\www\yii\framework;"

I was able to use yiic from within my www folder to successfully create the blog tutorial application (www\yii_blog), and I know that PDO works. The yii requirements checker confirmed this. I also wrote a standalone (non YII) test program to connect to a sqlite database, and it worked fine, however, I get the same problem that was reported by another user when attempting to issue a "model User" command under the yiic shell (see below). Is there something else I should be doing or that I've missed?

Thanks in advance!

E:\UniServer\udrive\www\yii_blog\protected>yiic shell …\index.php

Yii Interactive Tool v1.0 (based on Yii v1.0.5)

Please type 'help' for help. Type 'exit' to quit.

>> model User

PHP Fatal error:  Class 'PDO' not found in E:\UniServer\udrive\www\yii\framework\db\CDbConnection.php on line 274

I have solved my problem with the PDO class. I'm not 100% sure which one of the following steps actually resolved the problem, but here goes.

  1. I double-checked that there were no other php.ini files elsewhere on my system from an earlier installation. There were none (well, actually, I had a couple in my Windows folder, but I had previously suffixed their names with '.older' and '.oldest' extensions).

  2. I deleted an almost empty PHP folder from my Program Files folder, then ran CCleaner against my registry to remove any vestiges of the older PHP installation that had been in my Program Files folder.

  3. I ran phpinfo() from the command line and piped the output into a text file for review (turns out I never needed to do the review). While doing so, I got a bunch of "Unable to load dynamic library" messages so I went into the Uniform Server-supplied php.ini file and prefixed any unix-style names with the windows drive letter and all intervening parent folders.

  4. I tried phpinfo() a second time and determined that there was an uncommented extension (open_ssl) for which there was no actual file. I commented out the ini entry (I'll grab the file later if I learn that it's actually needed, then re-enable the corresponding extension entry in the php.ini file).

I think there are occasional issues in Windows that can be resolved with absolute, rather than relative file paths, so I think that item 3. is probably what fixed my problem. I'm still not sure why I could run existing PHP-based applications without those changes from within my Uniform Server environment…

Looking forward to continuing with the YII tutorial and working with the framework.