Tuesday, December 15, 2009

symfony: doctrine couldn't locate driver named mysql

followed the symfony's tutorial at chapter 3, when performed the command: php symfony doctrine:insert-sql, it complained:
doctrine created tables successfully
Couldn't locate driver named mysql

go check php.ini file, pdo_mysql was enabled:  extension=pdo_mysql.so
but when go into folder /etc/php5/conf.d/, only found: pdo.ini, xsl.ini and zend-framework.ini, so maybe pdo_mysql extension was actually not installed?

try to install pdo_mysql extension again:
sudo pecl install pdo_mysql
Ignoring installed package pecl/pdo_mysql
Nothing to install
uninstalled and reinstalled pecl/pdo_mysql wont' help.

searched around and found the solution here.
Odds are that your php.ini file for your CLI (often different from the apache php.ini) 
doesnt have pdo_mysql enabled. Enable it :)  

edit /etc/php5/cli and add the following to the end:
extension=pdo.so
extension=pdo_mysql.so
extension=apc.so
restarted apache and it works!

1 comment:

julien-at-dev310 said...

Tried your solution, doesn't works for me...

Still got the message driver mysql not found when i launch Doctrine command!

I modified php5/cli/php.ini, opt/lampp/etc/php.ini with your lines... but doesn't want to work...