Fatal Error: Class PDO Not found

After many years of rolling my own, I’ve just taken the plunge to using a web framework. I researched and settled on Yii. My hopes are being dashed as I’ve been getting this error on my first Web App (the Larry Ullman blog demo) when I try to model ModelName:

PHP Warning:  include(PDO.php): failed to open stream: No such file or directory in /WWW/t/transitioncolorado.org/framework/YiiBase.php on line 341

PHP Warning:  include(): Failed opening 'PDO.php' for inclusion (include_path='.:/WWW/t/transitioncolorado.org/html/yii_test/protected/components:/WWW/t/transitioncolorado.org/html/yii_test/protected/models:/usr/local/share/pear') in /WWW/t/transitioncolorado.org/framework/YiiBase.php on line 341

PHP Fatal error:  Class 'PDO' not found in /WWW/t/transitioncolorado.org/framework/db/CDbConnection.php on line 309

I’m using MySQL, and checking phpinfo() I see the PDO support is enabled for sqlite and mysql, and that pdo_mysql is turned on as well (client API version: mysqlnd 5.0.7-dev - 091210 - $Revision: 300533 $).

I’ve installed the framework directory at the same level as the html directory for security reasons, and compiled the webapp from there. Everything seems to be good there.

What’s wrong?

Thanks in advance.

The most common pitfall: Your CLI version of PHP uses another php.ini than the webserver module. Read the second red box here:


Also try

php --ini

to find the php.ini for the command line. You can edit it and add the PDO extension there.