-1

I am working on my local wamp server and trying to retrieve data from a phpMyAdmin. But i am getting an error.

could not find driver 500 Internal Server Error - PDOException

my routing.yml

# This file is auto-generated during the composer install
parameters:
    database_driver: pdo_mysql
    database_host: www.example.com
    database_port: null
    database_name: mydb
    database_user: myuser
    database_password: mypass
    mailer_transport: smtp
    mailer_host: www.example.com
    mailer_user: null
    mailer_password: null
    locale: en
    secret: ThisTokenIsNotSoSecretChangeIt
    database_path: null

my controller

$connection = $this->get("database_connection");
$statement = $connection->prepare("SELECT * FROM table");
$statement->execute();
$tabs = $statement->fetchAll();
abby
  • 680
  • 2
  • 10
  • 22
  • check your php.ini whether pdo_mysql is uncommented – Iłya Bursov Feb 13 '14 at 08:10
  • Are you trying to use Doctrine DBAL connection? http://symfony.com/doc/current/cookbook/doctrine/dbal.html `public function indexAction() { $conn = $this->get('database_connection'); $users = $conn->fetchAll('SELECT * FROM users'); // ... }` – jdharandas Feb 13 '14 at 08:14

1 Answers1

1

It looks like there's a driver issue. You need to make sure that your PHP environment has loaded pdo_mysql. For more info, see this post.

Community
  • 1
  • 1
Andrew Flanagan
  • 4,267
  • 3
  • 25
  • 37
  • it has already installed. Thats why i asked the question again. The post you mention does not include my answer. – abby Feb 13 '14 at 08:54
  • How are you verifying that it's installed? It's not enough for it to be on the system -- it must be configured in php.ini. A good way of checking is running phpinfo() (http://php.net/phpinfo). – Andrew Flanagan Feb 13 '14 at 08:56
  • Specifically, when you're running phpinfo(), does it actually list MySQL support under PDO? It may be that you have some base PDO library, but not the MySQL version that you need. – Andrew Flanagan Feb 13 '14 at 09:02