The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Uncaught exception 'PDOException' with message 'could not find driver'

Discussion in 'Database Discussions' started by MtotheC, Feb 25, 2013.

  1. MtotheC

    MtotheC Registered

    Joined:
    Feb 25, 2013
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi,

    I have been getting the error listed below on a site of mine:

    "
    Code:
    Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /home/vortexdn/public_html/tardis/navigation.php:9 Stack trace: #0 /home/vortexdn/public_html/tardis/navigation.php(9): PDO->__construct('DB_DRIVER:host=...', 'DB_USER', 'DB_PASS') #1 {main} thrown in /home/vortexdn/public_html/tardis/navigation.php on line 9"
    The script being used is (blocked out usernames and passwords :

    Code:
    "<?php
    $DB_DRIVER="mysql";
    $DB_HOST="localhost";
    $DB_PORT="3306";
    $DB_NAME="-";
    $DB_USER="-";
    $DB_PASS="-";
    
    $pdo = new PDO(DB_DRIVER.':host='.DB_HOST.';port='.DB_PORT.';dbname='.DB_NAME, DB_USER, DB_PASS);
    $stmt = $pdo -> prepare ("SELECT * FROM `rezzers` WHERE `ObjectName` = :param");
    $stmt -> execute(array(":param" => $myParam));
    $res = $stmt -> fetchAll(PDO::FETCH_ASSOC);
    foreach($res as $row) {echo $row['myField']."^";}
    
    ?>"
    ---------------------

    Any info on what may be causing this? I did a "php -i | grep -i pdo" command in terminal and came back with this:

    Code:
    Configure Command => './configure' '--disable-fileinfo' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-gd-native-ttf' '--enable-libxml' '--enable-magic-quotes' '--enable-mbstring' '--enable-pdo=shared' '--enable-sockets' '--enable-zip' '--prefix=/usr/local' '--with-curl=/opt/curlssl/' '--with-freetype-dir=/usr' '--with-gd' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pic' '--with-png-dir=/usr' '--with-sqlite=shared' '--with-xpm-dir=/usr' '--with-zlib' '--with-zlib-dir=/usr' '--with-litespeed'
    PDO
    PDO support => enabled
    PDO drivers => sqlite, sqlite2, mysql
    pdo_mysql
    PDO Driver for MySQL => enabled
    pdo_mysql.default_socket => /var/lib/mysql/mysql.sock => /var/lib/mysql/mysql.sock
    pdo_sqlite
    PDO Driver for SQLite 3.x => enabled
    ------------------------------

    Regards,

    Mike C.
     
  2. Jeff Shotnik

    Jeff Shotnik Well-Known Member

    Joined:
    Oct 10, 2012
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Denver, Colorado, United States
    cPanel Access Level:
    DataCenter Provider
    Do you have a php.ini in the account that does not contain the same configuration as the default php.ini? If you create a php.ini and, for example, just put 'memory_limit = 64M' you will overwrite other runtime settings set by the default php.ini.
     

Share This Page