How to use Linux Xampp mysql_pdo with Symfony 2.0

I have a serious problem. I would like to use Doctrine 2 on my Symfony 2 project.

I changed php path from application / console:

/opt/lampp/bin php 

I indicate a good path for my mysql_pdo in /opt/lampp/etc/php.ini

 pdo_mysql.default_socket = /opt/lampp/var/mysql/mysql.sock 

and check my php_info () for my pdo:

 PDO PDO support enabled PDO drivers mysql, pgsql, sqlite, sqlite2 pdo_mysql PDO Driver for MySQL enabled Client API version mysqlnd 5.0.7-dev - 091210 - $Revision: 304625 

$

 Directive Local Value Master Value 

pdo_mysql.default_socket / opt / lampp / var / mysql / mysql.sock / opt / lampp / var / mysql / mysql.sock

 pdo_pgsql PDO Driver for PostgreSQL enabled PostgreSQL(libpq) Version 8.0.3 Module version 1.0.2 Revision $Id: pdo_pgsql.c 300351 2010-06-10 12:11:19Z iliaa $ 

Everything seems fine, but when I use this Symfony command:

 php app/console doctrine:mapping:import WonderWBundle yml 

This juste says:

[PDOException] could not find driver

I'm on Ubuntu 10.10 XAMPP for Linux 1.7.4!

It seems I have everything for Pdo to work well, but not on Symfony 2. Can anyone help? Pleeeaaaassse (I'm crazy !!)

Thank you very much: P

(PS: Grrr cannot link my screenshots!)

+4
source share
1 answer

Another reason could be related to PHP itself. Different Linux distributions compile their php-cgi/fpm/apache and php-cli to use different php.ini files (which really makes sense)

Both ini files use module configuration files included in subdirectories. If you install the add-on module manually, `phpinfo ()? viewed in a web browser can display the module, but programs running on the command line, like the Zend Framework application / console, use php-cli with a different configuration.

eg. for apache module

 /etc/php/php-apache/php.ini /etc/php/php-apache/php.d/pdo_mysql.ini 

for php command line

 /etc/php/php-cli/php.ini 

In this case, you need to re-configure your module for the command line client

 /etc/php/php-cli/php.d/pdo_mysql.ini 

There is also a phpinfo function phpinfo php command line that you can use to verify your cli installation:

 ~ # php -i | grep "pdo" 
+1
source

All Articles