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

MtotheC

Registered
Feb 25, 2013
1
0
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.
 

Jeff Shotnik

Well-Known Member
Oct 10, 2012
61
0
6
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.
 
Thread starter Similar threads Forum Replies Date
M Databases 2