Cdbconnection Failed To Open The Db Connection: Could Not Find Driver

I’m moving an application from a server with php5.2.x to one with php5.5.x. The application works normally when running off the main config file, but when I trigger a console command I get the error, “CDbConnection failed to open the DB connection: could not find driver.” I’ve seen the same error in several other forum posts, but none have gotten me to a solution so far.

The server is IIS 7.0.

In php5.5.x there is no php_pdo extension, but I do have php_mysql and php_pdo_mysql enabled. phpinfo() shows the correct path information to the extension directory. I tried running it on the new server under php5.2.x and got the same error message.

I have copied and pasted the same db connection from main.php (which is working) into console.php.

The mysql database is on a different server and has not moved or changed in any way.

Any suggestions?

Thanks in advance.

Make sure your php cli version ini file is updated with the proper extension as well.

This might help http://stackoverflow.com/questions/10844641/how-to-change-the-path-to-php-ini-in-php-cli-version

You were exactly correct. Thanks! I have multiple versions of php on the server. I rearranged the 5.5.x version to the front of my path variable and everything is happy now. For now all I need is the one version in full working order. In the long term I will keep trying to figure out how to get php cli to discern the proper ini file to use.