Yii Framework Forum: Issue with PDO - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Issue with PDO Rate Topic: -----

#1 User is offline   thilot69 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 29-May 09
  • Location:Lyon Ouest

Posted 29 May 2009 - 04:34 AM

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.  ;)
0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,879
  • Joined: 04-October 08
  • Location:DC, USA

Posted 29 May 2009 - 11:52 AM

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.
0

#3 User is offline   Saevan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 19-May 09

Posted 29 May 2009 - 04:31 PM

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.


0

#4 User is offline   orillia319 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 04-June 09

Posted 05 June 2009 - 01:49 PM

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
0

#5 User is offline   orillia319 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 04-June 09

Posted 05 June 2009 - 03:25 PM

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.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users