1

I have installed AppServer 2.5.10 (including Apache and MySQL) and I get this error:

Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in C:\AppServ\www\compras.mysql\bd.php:17 Stack trace: #0 C:\AppServ\www\compras.mysql\bd.php(17): PDO->__construct('mysql:host=loca...', 'root', 'root') #1 C:\AppServ\www\compras.mysql\datos.php(9): Bd->__construct() #2 C:\AppServ\www\compras.mysql\index.php(6): categorias() #3 {main} thrown in C:\AppServ\www\compras.mysql\bd.php on line 17

I already uncommented the "extension=php_pdo_mysql.dll" line in the php.ini document located in Windows but it still doesn´t work.

   function __construct() {
    $this->usuario = 'root';
    $this->clave = 'root';
    $this->dsn = 'mysql:host=localhost;dbname=compras';
    $this->conn = new PDO(
            $this->dsn, 
            $this->usuario, 
            $this->clave);
}

That´s part of my code. The line stated in the error is the one used to create the new PDO. Any idea why it isn´t working?

moondaisy
  • 4,303
  • 6
  • 41
  • 70
  • This means, the mysql daemon may not be runing, you may beed to restart your application. – samayo Feb 17 '15 at 15:29
  • I think it means that you don't have the mysql client libraries installed. I don't know anything about windows, but on linux, there's usually a package for php-mysql or php-pdo-mysql, or something like that. – Halfstop Feb 17 '15 at 15:32

1 Answers1

0

habilite a extensão PDO_MYSQL/enable the extension PDO_MYSQ

cd php5.3.29/ext/pdo_mysql
   phpize
   ./configure
   make && make install

#php.ini
extension=pdo_mysql.so
gilcierweb
  • 2,598
  • 1
  • 16
  • 15