can't access PDO from yiic console

I am attempting to create my first model using the yiic console and I get these errors:

include(PDO.php) [<a href=‘function.include’>function.include</a>]: failed to open stream: No such file or directory in <b>/home1/resolut1/public_html/yii/framework/YiiBase.php</b> on line <b>324</b><br />

<br />

<b>Warning</b>: include(PDO.php) [<a href=‘function.include’>function.include</a>]: failed to open stream: No such file or directory in <b>/home1/resolut1/public_html/yii/framework/YiiBase.php</b> on line <b>324</b><br />

<br />

<b>Warning</b>: include() [<a href=‘function.include’>function.include</a>]: Failed opening ‘PDO.php’ for inclusion (include_path=’.:/home1/resolut1/public_html/yii/jobsearch/protected/components:/home1/resolut1/public_html/yii/jobsearch/protected/models:/usr/lib/php:/usr/local/lib/php’) in <b>/home1/resolut1/public_html/yii/framework/YiiBase.php</b> on line <b>324</b><br />

<br />

<b>Fatal error</b>: Class ‘PDO’ not found in <b>/home1/resolut1/public_html/yii/framework/db/CDbConnection.php</b> on line <b>282</b><br />

I specify a php.ini file that has PDO enabled.

Thanks in advance for any suggestions.

You should use the same php.ini file your webserver uses. You can provide it with the -c option.

It seems that the ini file is not correct in some way. Is it the same ini file the webserver uses?

Yes I’m using the same php.ini that my webserver uses when I load my test application in the web browser, and my hosting company has confirmed that I have PDO enabled for my environment. such a mystery!

Check the output of phphinfo() for the CLI:


php -c /your/php.ini -r 'phpinfo();' > phpinfo.txt

You should find information about PDO there.